When producing LLVM IR using clang -O0, a noinline attribute is added.
Remove this attribute to not inhibit future optimization.
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
.../passes/PrepareForOptPass/PrepareForOptPass.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/subprojects/helper-to-tcg/passes/PrepareForOptPass/PrepareForOptPass.cpp b/subprojects/helper-to-tcg/passes/PrepareForOptPass/PrepareForOptPass.cpp
index b357debb5d..cfd1c23c24 100644
--- a/subprojects/helper-to-tcg/passes/PrepareForOptPass/PrepareForOptPass.cpp
+++ b/subprojects/helper-to-tcg/passes/PrepareForOptPass/PrepareForOptPass.cpp
@@ -25,6 +25,7 @@
#include <llvm/IR/Instructions.h>
#include <llvm/IR/Intrinsics.h>
#include <llvm/IR/Module.h>
+#include <llvm/Transforms/Utils/Local.h>
#include <queue>
#include <set>
@@ -249,5 +250,11 @@ PreservedAnalyses PrepareForOptPass::run(Module &M, ModuleAnalysisManager &MAM)
collectAnnotations(M, ResultAnnotations);
cullUnusedFunctions(M, ResultAnnotations, TranslateAllHelpers);
replaceRetaddrWithUndef(M);
+ // Remove noinline function attributes automatically added by -O0
+ for (Function &F : M) {
+ if (F.hasFnAttribute(Attribute::AttrKind::NoInline)) {
+ F.removeFnAttr(Attribute::AttrKind::NoInline);
+ }
+ }
return PreservedAnalyses::none();
}
--
2.45.2