aboutsummaryrefslogtreecommitdiff
path: root/src/backend/jit/llvm/llvmjit_inline.cpp
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2018-07-25 16:23:59 -0700
committerAndres Freund <andres@anarazel.de>2018-07-25 16:23:59 -0700
commitbcafa263ec408ae8e383e389832b2a623900a55c (patch)
tree2cd4898b0aebf0e7b7d1e93c52b42fc2bba72aec /src/backend/jit/llvm/llvmjit_inline.cpp
parent167075be3ab1547e186096bb8e6e448cd8eea5af (diff)
downloadpostgresql-bcafa263ec408ae8e383e389832b2a623900a55c.tar.gz
postgresql-bcafa263ec408ae8e383e389832b2a623900a55c.zip
LLVMJIT: Check for 'noinline' attribute in recursively inlined functions.
Previously the attribute was only checked for external functions inlined, not "static" functions that had to be inlined as dependencies. This isn't really a bug, but makes debugging a bit harder. The new behaviour also makes more sense. Therefore backpatch. Author: Andres Freund Backpatch: 11-, where JIT compilation was added
Diffstat (limited to 'src/backend/jit/llvm/llvmjit_inline.cpp')
-rw-r--r--src/backend/jit/llvm/llvmjit_inline.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/backend/jit/llvm/llvmjit_inline.cpp b/src/backend/jit/llvm/llvmjit_inline.cpp
index 130e2ab415e..b33a32141d1 100644
--- a/src/backend/jit/llvm/llvmjit_inline.cpp
+++ b/src/backend/jit/llvm/llvmjit_inline.cpp
@@ -287,14 +287,6 @@ llvm_build_inline_plan(llvm::Module *mod)
Assert(!funcDef->isDeclaration());
Assert(funcDef->hasExternalLinkage());
- /* don't inline functions marked as noinline */
- if (funcDef->getAttributes().hasFnAttribute(llvm::Attribute::NoInline))
- {
- ilog(DEBUG1, "ineligibile to import %s due to noinline",
- symbolName.data());
- continue;
- }
-
llvm::StringSet<> importVars;
llvm::SmallPtrSet<const llvm::Function *, 8> visitedFunctions;
int running_instcount = 0;
@@ -600,6 +592,13 @@ function_inlinable(llvm::Function &F,
if (F.materialize())
elog(FATAL, "failed to materialize metadata");
+ if (F.getAttributes().hasFnAttribute(llvm::Attribute::NoInline))
+ {
+ ilog(DEBUG1, "ineligibile to import %s due to noinline",
+ F.getName().data());
+ return false;
+ }
+
function_references(F, running_instcount, referencedVars, referencedFunctions);
for (llvm::GlobalVariable* rv: referencedVars)