Skip to content

Commit 1cfa69d

Browse files
committed
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
1 parent f2db5f3 commit 1cfa69d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/backend/jit/llvm/llvmjit_inline.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,14 +287,6 @@ llvm_build_inline_plan(llvm::Module *mod)
287287
Assert(!funcDef->isDeclaration());
288288
Assert(funcDef->hasExternalLinkage());
289289

290-
/* don't inline functions marked as noinline */
291-
if (funcDef->getAttributes().hasFnAttribute(llvm::Attribute::NoInline))
292-
{
293-
ilog(DEBUG1, "ineligibile to import %s due to noinline",
294-
symbolName.data());
295-
continue;
296-
}
297-
298290
llvm::StringSet<> importVars;
299291
llvm::SmallPtrSet<const llvm::Function *, 8> visitedFunctions;
300292
int running_instcount = 0;
@@ -600,6 +592,13 @@ function_inlinable(llvm::Function &F,
600592
if (F.materialize())
601593
elog(FATAL, "failed to materialize metadata");
602594

595+
if (F.getAttributes().hasFnAttribute(llvm::Attribute::NoInline))
596+
{
597+
ilog(DEBUG1, "ineligibile to import %s due to noinline",
598+
F.getName().data());
599+
return false;
600+
}
601+
603602
function_references(F, running_instcount, referencedVars, referencedFunctions);
604603

605604
for (llvm::GlobalVariable* rv: referencedVars)

0 commit comments

Comments
 (0)