aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-01 18:44:06 +0000
committerChris Lattner <sabre@nondot.org>2009-09-01 18:44:06 +0000
commit81dfb3885252fbf621b080827a080099864415f8 (patch)
tree9297b00133abca6d1670a860711a84aa6987c6bb /lib/Transforms/Utils
parent1f1522839838a33e69d68656a423a244e19dffb8 (diff)
downloadexternal_llvm-81dfb3885252fbf621b080827a080099864415f8.zip
external_llvm-81dfb3885252fbf621b080827a080099864415f8.tar.gz
external_llvm-81dfb3885252fbf621b080827a080099864415f8.tar.bz2
remove a bunch of explicit code previously needed to update the
callgraph. This is now dead because RAUW does the job. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80703 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp34
1 files changed, 7 insertions, 27 deletions
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 00ccaf8..7004248 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -43,13 +43,11 @@ bool llvm::InlineFunction(InvokeInst *II, CallGraph *CG, const TargetData *TD,
/// an invoke, we have to check all of all of the calls that can throw into
/// invokes. This function analyze BB to see if there are any calls, and if so,
/// it rewrites them to be invokes that jump to InvokeDest and fills in the PHI
-/// nodes in that block with the values specified in InvokeDestPHIValues. If
-/// CallerCGN is specified, this function updates the call graph.
+/// nodes in that block with the values specified in InvokeDestPHIValues.
///
static void HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB,
BasicBlock *InvokeDest,
- const SmallVectorImpl<Value*> &InvokeDestPHIValues,
- CallGraphNode *CallerCGN) {
+ const SmallVectorImpl<Value*> &InvokeDestPHIValues) {
for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) {
Instruction *I = BBI++;
@@ -76,24 +74,10 @@ static void HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB,
II->setCallingConv(CI->getCallingConv());
II->setAttributes(CI->getAttributes());
- // Make sure that anything using the call now uses the invoke!
+ // Make sure that anything using the call now uses the invoke! This also
+ // updates the CallGraph if present.
CI->replaceAllUsesWith(II);
- // Update the callgraph if present.
- if (CallerCGN) {
- // We should be able to do this:
- // (*CG)[Caller]->replaceCallSite(CI, II);
- // but that fails if the old call site isn't in the call graph,
- // which, because of LLVM bug 3601, it sometimes isn't.
- for (CallGraphNode::iterator NI = CallerCGN->begin(), NE = CallerCGN->end();
- NI != NE; ++NI) {
- if (NI->first == CI) {
- NI->first = II;
- break;
- }
- }
- }
-
// Delete the unconditional branch inserted by splitBasicBlock
BB->getInstList().pop_back();
Split->getInstList().pop_front(); // Delete the original call
@@ -120,8 +104,7 @@ static void HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB,
/// block of the inlined code (the last block is the end of the function),
/// and InlineCodeInfo is information about the code that got inlined.
static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
- ClonedCodeInfo &InlinedCodeInfo,
- CallGraph *CG) {
+ ClonedCodeInfo &InlinedCodeInfo) {
BasicBlock *InvokeDest = II->getUnwindDest();
SmallVector<Value*, 8> InvokeDestPHIValues;
@@ -150,13 +133,10 @@ static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
return;
}
- CallGraphNode *CallerCGN = 0;
- if (CG) CallerCGN = (*CG)[Caller];
-
for (Function::iterator BB = FirstNewBlock, E = Caller->end(); BB != E; ++BB){
if (InlinedCodeInfo.ContainsCalls)
HandleCallsInBlockInlinedThroughInvoke(BB, InvokeDest,
- InvokeDestPHIValues, CallerCGN);
+ InvokeDestPHIValues);
if (UnwindInst *UI = dyn_cast<UnwindInst>(BB->getTerminator())) {
// An UnwindInst requires special handling when it gets inlined into an
@@ -539,7 +519,7 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD,
// any inlined 'unwind' instructions into branches to the invoke exception
// destination, and call instructions into invoke instructions.
if (InvokeInst *II = dyn_cast<InvokeInst>(TheCall))
- HandleInlinedInvoke(II, FirstNewBlock, InlinedFunctionInfo, CG);
+ HandleInlinedInvoke(II, FirstNewBlock, InlinedFunctionInfo);
// If we cloned in _exactly one_ basic block, and if that block ends in a
// return instruction, we splice the body of the inlined callee directly into