[llvm-commits] CVS: llvm/lib/Transforms/Utils/InlineFunction.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Jul 12 11:37:31 PDT 2006
Changes in directory llvm/lib/Transforms/Utils:
InlineFunction.cpp updated: 1.43 -> 1.44
---
Log message:
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.
---
Diffs of the changes: (+4 -2)
InlineFunction.cpp | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.43 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.44
--- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.43 Wed Jul 12 13:29:36 2006
+++ llvm/lib/Transforms/Utils/InlineFunction.cpp Wed Jul 12 13:37:18 2006
@@ -158,8 +158,10 @@
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);
}
}
}
More information about the llvm-commits
mailing list