diff options
author | Chris Lattner <sabre@nondot.org> | 2006-07-12 18:37:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-07-12 18:37:18 +0000 |
commit | 1bb3a402574557cb228f8a96030776c229e282e5 (patch) | |
tree | f5c1a8093e21fc87e934b5ac16332fca51cc5a77 /lib/Transforms/Utils/InlineFunction.cpp | |
parent | d85340f4ec587e22b0239617f3b747a6df113894 (diff) | |
download | llvm-1bb3a402574557cb228f8a96030776c229e282e5.tar.gz llvm-1bb3a402574557cb228f8a96030776c229e282e5.tar.bz2 llvm-1bb3a402574557cb228f8a96030776c229e282e5.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29121 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r-- | lib/Transforms/Utils/InlineFunction.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index 277b10a767..eeb69116ed 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/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); } } } |