[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Feb 4 01:52:55 PST 2006



Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.74 -> 1.75
---
Log message:

Use SCEVExpander::InsertCastOfTo instead of our own code.  This reduces 
#LLVM LOC, and auto-cse's cast instructions.


---
Diffs of the changes:  (+1 -18)

 LoopStrengthReduce.cpp |   19 +------------------
 1 files changed, 1 insertion(+), 18 deletions(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.74 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.75
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.74	Sat Feb  4 01:36:50 2006
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Sat Feb  4 03:52:43 2006
@@ -176,24 +176,7 @@
   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;
 }






More information about the llvm-commits mailing list