From 0a70f219f45077dfaa7e37ad1ed6f760f1f7a1e8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 4 Feb 2006 09:52:43 +0000 Subject: [PATCH] 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 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 49d0c58a644..45a79d7f037 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(V)) { - // Insert into the entry of the function, after any allocas. - InsertPt = Arg->getParent()->begin()->begin(); - while (isa(InsertPt)) ++InsertPt; - } else { - if (InvokeInst *II = dyn_cast(V)) { - InsertPt = II->getNormalDest()->begin(); - } else { - InsertPt = cast(V); - ++InsertPt; - } - - // Do not insert casts into the middle of PHI node blocks. - while (isa(InsertPt)) ++InsertPt; - } - - New = new CastInst(V, UIntPtrTy, V->getName(), InsertPt); + New = SCEVExpander::InsertCastOfTo(V, UIntPtrTy); DeadInsts.insert(cast(New)); return New; } -- 2.34.1