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

Dale Johannesen dalej at apple.com
Sun Mar 25 20:01:58 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.121 -> 1.122
---
Log message:

Look through bitcast when finding IVs.  (Chris' patch really.)


---
Diffs of the changes:  (+10 -0)

 LoopStrengthReduce.cpp |   10 ++++++++++
 1 files changed, 10 insertions(+)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.121 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.122
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.121	Tue Mar 20 16:54:54 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp	Sun Mar 25 22:01:27 2007
@@ -235,6 +235,16 @@
 /// GetExpressionSCEV - Compute and return the SCEV for the specified
 /// instruction.
 SCEVHandle LoopStrengthReduce::GetExpressionSCEV(Instruction *Exp, Loop *L) {
+  // Pointer to pointer bitcast instructions return the same value as their
+  // operand.
+  if (BitCastInst *BCI = dyn_cast<BitCastInst>(Exp)) {
+    if (SE->hasSCEV(BCI) || !isa<Instruction>(BCI->getOperand(0)))
+      return SE->getSCEV(BCI);
+    SCEVHandle R = GetExpressionSCEV(cast<Instruction>(BCI->getOperand(0)), L);
+    SE->setSCEV(BCI, R);
+    return R;
+  }
+
   // Scalar Evolutions doesn't know how to compute SCEV's for GEP instructions.
   // If this is a GEP that SE doesn't know about, compute it now and insert it.
   // If this is not a GEP, or if we have already done this computation, just let






More information about the llvm-commits mailing list