summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-01-21 10:08:42 +0000
committerDan Gohman <gohman@apple.com>2010-01-21 10:08:42 +0000
commit60a9bf414e9074e8e49718cd340224b1ab359f43 (patch)
treecd9d8f176cdb2978e806dfb2a305c81ab13890d1 /llvm/lib
parent9e26c1cc0c48bf9fed270ec9d6abdb46fbc8114c (diff)
downloadbcm5719-llvm-60a9bf414e9074e8e49718cd340224b1ab359f43.tar.gz
bcm5719-llvm-60a9bf414e9074e8e49718cd340224b1ab359f43.zip
When re-using an existing cast for a user, it's still necessary to call
rememberInstruction so that future users of that user will be inserted in the correct position. This fixes the Darwin selfhost. llvm-svn: 94070
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/ScalarEvolutionExpander.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
index b049f424fa8..a72f58f64fa 100644
--- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -98,14 +98,16 @@ Value *SCEVExpander::InsertNoopCastOfTo(Value *V, const Type *Ty) {
It = cast<InvokeInst>(I)->getNormalDest()->begin();
while (isa<PHINode>(It)) ++It;
if (It != BasicBlock::iterator(CI)) {
- // Recreate the cast at the beginning of the entry block.
+ // Recreate the cast after the user.
// The old cast is left in place in case it is being used
// as an insert point.
Instruction *NewCI = CastInst::Create(Op, V, Ty, "", It);
NewCI->takeName(CI);
CI->replaceAllUsesWith(NewCI);
+ rememberInstruction(NewCI);
return NewCI;
}
+ rememberInstruction(CI);
return CI;
}
}
OpenPOWER on IntegriCloud