summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-07-12 18:37:18 +0000
committerChris Lattner <sabre@nondot.org>2006-07-12 18:37:18 +0000
commit6148456ec2ec7503e13e851e0cab986cdd5a9e69 (patch)
treecb01132907eac734fe286a1e8ba2ca202d831b76 /llvm/lib/Transforms/Utils/InlineFunction.cpp
parent5de3b8b26264ccd11a4141d41061ea2040fa69ca (diff)
downloadbcm5719-llvm-6148456ec2ec7503e13e851e0cab986cdd5a9e69.tar.gz
bcm5719-llvm-6148456ec2ec7503e13e851e0cab986cdd5a9e69.zip
In addition to deleting calls, the inliner can constant fold them as well.
Handle this case, which doesn't require a new callgraph edge. This fixes a crash compiling MallocBench/gs. llvm-svn: 29121
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 277b10a767f..eeb69116ed5 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -158,8 +158,10 @@ static void UpdateCallGraphAfterInlining(const Function *Caller,
std::map<const Value*, Value*>::iterator VMI = ValueMap.find(OrigCall);
if (VMI != ValueMap.end()) { // Only copy the edge if the call was inlined!
- Instruction *NewCall = cast<Instruction>(VMI->second);
- CallerNode->addCalledFunction(CallSite::get(NewCall), I->second);
+ // If the call was inlined, but then constant folded, there is no edge to
+ // add. Check for this case.
+ if (Instruction *NewCall = dyn_cast<Instruction>(VMI->second))
+ CallerNode->addCalledFunction(CallSite::get(NewCall), I->second);
}
}
}
OpenPOWER on IntegriCloud