aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopStrengthReduce.cpp
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
commit0a70f219f45077dfaa7e37ad1ed6f760f1f7a1e8 (patch)
tree5d9ccbc13a311cc0086027cc94fddd8db0cd37e7 /lib/Transforms/Scalar/LoopStrengthReduce.cpp
parentca1a4bebb3928ba18fb8751e2f0c0f88fad54cfd (diff)
Use SCEVExpander::InsertCastOfTo instead of our own code. This reduces
#LLVM LOC, and auto-cse's cast instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25974 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp19
1 files changed, 1 insertions, 18 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 49d0c58a64..45a79d7f03 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/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;
}