[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

Dan Gohman djg at cray.com
Mon Jun 18 12:30:32 PDT 2007



Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.119 -> 1.120
---
Log message:

In SCEVAddExpr::get, skip over any cast operands before looking for nested
add operands after constant operands. The recent change to recognize
sign-extend expressions caused this to be exposed more often.


---
Diffs of the changes:  (+5 -2)

 ScalarEvolution.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.119 llvm/lib/Analysis/ScalarEvolution.cpp:1.120
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.119	Fri Jun 15 09:38:12 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp	Mon Jun 18 14:30:09 2007
@@ -685,8 +685,11 @@
       return SCEVAddExpr::get(Ops);
     }
 
-  // Okay, now we know the first non-constant operand.  If there are add
-  // operands they would be next.
+  // Now we know the first non-constant operand.  Skip past any cast SCEVs.
+  while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scAddExpr)
+    ++Idx;
+
+  // If there are add operands they would be next.
   if (Idx < Ops.size()) {
     bool DeletedAdd = false;
     while (SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Ops[Idx])) {






More information about the llvm-commits mailing list