diff options
| author | David Blaikie <dblaikie@gmail.com> | 2017-06-12 23:01:17 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2017-06-12 23:01:17 +0000 |
| commit | ae8c4af4ac9800b2fd8b6762e36c72be34db7008 (patch) | |
| tree | b77566dd543f1970bc4f0d668ec79de184914830 | |
| parent | f45e6462caf338ad0b5e367cd2bb9f239d53bdca (diff) | |
| download | bcm5719-llvm-ae8c4af4ac9800b2fd8b6762e36c72be34db7008.tar.gz bcm5719-llvm-ae8c4af4ac9800b2fd8b6762e36c72be34db7008.zip | |
Inliner: Don't remove calls to readnone+nounwind (but not always_inline) functions in the AlwaysInliner
llvm-svn: 305245
| -rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 19 | ||||
| -rw-r--r-- | llvm/test/Transforms/Inline/always-inline.ll | 11 |
2 files changed, 21 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index c0dfeede05c..1de4a21d7f2 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -523,6 +523,16 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG, if (!Callee || Callee->isDeclaration()) continue; + // FIXME for new PM: because of the old PM we currently generate ORE and + // in turn BFI on demand. With the new PM, the ORE dependency should + // just become a regular analysis dependency. + OptimizationRemarkEmitter ORE(Caller); + + // If the policy determines that we should inline this function, + // delete the call instead. + if (!shouldInline(CS, GetInlineCost, ORE)) + continue; + // If this call site is dead and it is to a readonly function, we should // just delete the call instead of trying to inline it, regardless of // size. This happens because IPSCCP propagates the result out of the @@ -548,15 +558,6 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG, // Get DebugLoc to report. CS will be invalid after Inliner. DebugLoc DLoc = CS.getInstruction()->getDebugLoc(); BasicBlock *Block = CS.getParent(); - // FIXME for new PM: because of the old PM we currently generate ORE and - // in turn BFI on demand. With the new PM, the ORE dependency should - // just become a regular analysis dependency. - OptimizationRemarkEmitter ORE(Caller); - - // If the policy determines that we should inline this function, - // try to do so. - if (!shouldInline(CS, GetInlineCost, ORE)) - continue; // Attempt to inline the function. using namespace ore; diff --git a/llvm/test/Transforms/Inline/always-inline.ll b/llvm/test/Transforms/Inline/always-inline.ll index 5366b5a16cc..791eb94779b 100644 --- a/llvm/test/Transforms/Inline/always-inline.ll +++ b/llvm/test/Transforms/Inline/always-inline.ll @@ -305,3 +305,14 @@ entry: ret void ; CHECK: ret void } + +define void @inner14() readnone nounwind { +; CHECK: define void @inner14 + ret void +} + +define void @outer14() { +; CHECK: call void @inner14 + call void @inner14() + ret void +} |

