diff options
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 19 |
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; } |