summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-02-04 09:52:43 +0000
committerChris Lattner <sabre@nondot.org>2006-02-04 09:52:43 +0000
commitd30c4991a196ca9a46f0057715864dd5adfa3fe6 (patch)
tree7ec4e48d63d64b268be1e76d8106c705a41c90c8
parenta6da69cab0dc97be1ffdcfb62c8c3807b70b228d (diff)
downloadbcm5719-llvm-d30c4991a196ca9a46f0057715864dd5adfa3fe6.tar.gz
bcm5719-llvm-d30c4991a196ca9a46f0057715864dd5adfa3fe6.zip
Use SCEVExpander::InsertCastOfTo instead of our own code. This reduces
#LLVM LOC, and auto-cse's cast instructions. llvm-svn: 25974
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp19
1 files changed, 1 insertions, 18 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 49d0c58a644..45a79d7f037 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -176,24 +176,7 @@ Value *LoopStrengthReduce::getCastedVersionOf(Value *V) {
Value *&New = CastedPointers[V];
if (New) return New;
- BasicBlock::iterator InsertPt;
- if (Argument *Arg = dyn_cast<Argument>(V)) {
- // Insert into the entry of the function, after any allocas.
- InsertPt = Arg->getParent()->begin()->begin();
- while (isa<AllocaInst>(InsertPt)) ++InsertPt;
- } else {
- if (InvokeInst *II = dyn_cast<InvokeInst>(V)) {
- InsertPt = II->getNormalDest()->begin();
- } else {
- InsertPt = cast<Instruction>(V);
- ++InsertPt;
- }
-
- // Do not insert casts into the middle of PHI node blocks.
- while (isa<PHINode>(InsertPt)) ++InsertPt;
- }
-
- New = new CastInst(V, UIntPtrTy, V->getName(), InsertPt);
+ New = SCEVExpander::InsertCastOfTo(V, UIntPtrTy);
DeadInsts.insert(cast<Instruction>(New));
return New;
}
OpenPOWER on IntegriCloud