Skip to content

Commit 1cf582f

Browse files
committed
Fix LLVM JIT hangs
1 parent 10538cd commit 1cf582f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/dev/engine/internal/llvm/llvmcodebuilder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ std::shared_ptr<ExecutableCode> LLVMCodeBuilder::finalize()
8282
if (m_procedurePrototype && m_warp)
8383
func->addFnAttr(llvm::Attribute::InlineHint);
8484
else {
85+
// NOTE: These attributes will be overriden by LLVMCompilerContext
86+
// TODO: Optimize all functions, maybe it doesn't take so long
8587
func->addFnAttr(llvm::Attribute::NoInline);
8688
func->addFnAttr(llvm::Attribute::OptimizeNone);
8789
}

src/dev/engine/internal/llvm/llvmcompilercontext.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ void LLVMCompilerContext::initJit()
8888
std::cout << "debug: optimizing function: " << functionNames.back() << std::endl;
8989
#endif
9090
functionPassManager.run(func, functionAnalysisManager);
91+
} else if (func.hasFnAttribute(llvm::Attribute::OptimizeNone)) {
92+
// Remove this attribute to avoid JIT hangs
93+
// TODO: Optimize all functions, maybe it doesn't take so long
94+
func.removeFnAttr(llvm::Attribute::OptimizeNone);
9195
}
9296
}
9397
}

0 commit comments

Comments
 (0)