diff options
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 5 |
2 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index 8ed4bda54ad..c82c7dfe4cf 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -580,11 +580,13 @@ bool Inliner::runOnSCC(CallGraphSCC &SCC) { continue; } updateEntryCount(CallSiteBlock, Callee); - // The instruction following the call is part of a new basic block - // created during the inlining process. This does not have an entry in - // the BFI. We create an entry by copying the frequency of the original - // block containing the call. - copyBlockFrequency(CallSiteBlock, CallSuccessor->getParent()); + if (!InlineInfo.CallSuccessorBlockDeleted) { + // The instruction following the call is part of a new basic block + // created during the inlining process. This does not have an entry in + // the BFI. We create an entry by copying the frequency of the + // original block containing the call. + copyBlockFrequency(CallSiteBlock, CallSuccessor->getParent()); + } ++NumInlined; diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 923e5b231c4..251afb57b1f 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1994,8 +1994,11 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI, // If we inlined any musttail calls and the original return is now // unreachable, delete it. It can only contain a bitcast and ret. - if (InlinedMustTailCalls && pred_begin(AfterCallBB) == pred_end(AfterCallBB)) + if (InlinedMustTailCalls && + pred_begin(AfterCallBB) == pred_end(AfterCallBB)) { + IFI.CallSuccessorBlockDeleted = true; AfterCallBB->eraseFromParent(); + } // We should always be able to fold the entry block of the function into the // single predecessor of the block... |