Use the ClonedCodeInfo object to avoid scans of the inlined code when

it doesn't contain any calls.  This is a fairly common case for C++ code,
so it will probably speed up the inliner marginally in these cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25284 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2006-01-13 19:15:15 +00:00
parent cd4d339ec1
commit 727d1dd587

View File

@@ -51,17 +51,20 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
// The inlined code is currently at the end of the function, scan from the
// start of the inlined code to its end, checking for stuff we need to
// rewrite.
if (InlinedCodeInfo.ContainsCalls || InlinedCodeInfo.ContainsUnwinds) {
for (Function::iterator BB = FirstNewBlock, E = Caller->end();
BB != E; ++BB) {
if (InlinedCodeInfo.ContainsCalls) {
for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ){
Instruction *I = BBI++;
// We only need to check for function calls: inlined invoke instructions
// require no special handling.
// We only need to check for function calls: inlined invoke
// instructions require no special handling.
if (!isa<CallInst>(I)) continue;
CallInst *CI = cast<CallInst>(I);
// If this is an intrinsic function call, do not convert it to an invoke.
// If this is an intrinsic function call, don't convert it to an
// invoke.
if (CI->getCalledFunction() &&
CI->getCalledFunction()->getIntrinsicID())
continue;
@@ -97,6 +100,7 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
// This basic block is now complete, start scanning the next one.
break;
}
}
if (UnwindInst *UI = dyn_cast<UnwindInst>(BB->getTerminator())) {
// An UnwindInst requires special handling when it gets inlined into an
@@ -118,6 +122,7 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
}
}
}
}
// Now that everything is happy, we have one final detail. The PHI nodes in
// the exception destination block still have entries due to the original