[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Oct 29 18:47:01 PST 2003
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.131 -> 1.132
---
Log message:
Fix bug: 2003-10-29-CallSiteResolve.ll & PR70
---
Diffs of the changes: (+11 -1)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.131 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.132
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.131 Mon Oct 20 14:43:19 2003
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Oct 29 18:46:41 2003
@@ -1739,7 +1739,17 @@
if (Caller->getType() != NV->getType() && !Caller->use_empty()) {
if (NV->getType() != Type::VoidTy) {
NV = NC = new CastInst(NC, Caller->getType(), "tmp");
- InsertNewInstBefore(NC, *Caller);
+
+ // If this is an invoke instruction, we should insert it after the first
+ // non-phi, instruction in the normal successor block.
+ if (InvokeInst *II = dyn_cast<InvokeInst>(Caller)) {
+ BasicBlock::iterator I = II->getNormalDest()->begin();
+ while (isa<PHINode>(I)) ++I;
+ InsertNewInstBefore(NC, *I);
+ } else {
+ // Otherwise, it's a call, just insert cast right after the call instr
+ InsertNewInstBefore(NC, *Caller);
+ }
AddUsesToWorkList(*Caller);
} else {
NV = Constant::getNullValue(Caller->getType());
More information about the llvm-commits
mailing list