diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -58,6 +58,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Transforms/IPO/AlwaysInliner.h" #include "llvm/Transforms/Utils/CallPromotionUtils.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h" @@ -1055,6 +1056,7 @@ return PreservedAnalyses::all(); } + MPM.addPass(AlwaysInlinerPass()); // We wrap the CGSCC pipeline in a devirtualization repeater. This will try // to detect when we devirtualize indirect calls and iterate the SCC passes // in that case to try and catch knock-on inlining or function attrs diff --git a/llvm/test/Transforms/Inline/pr46945.ll b/llvm/test/Transforms/Inline/pr46945.ll new file mode 100644 --- /dev/null +++ b/llvm/test/Transforms/Inline/pr46945.ll @@ -0,0 +1,18 @@ +; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s + +; CHECK-NOT: call void @b() +define void @a() { +entry: + call void @b() + ret void +} + +define void @b() alwaysinline { +entry: + br label %for.cond + +for.cond: + call void @a() + br label %for.cond +} +