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

Reid Spencer reid at x10sys.com
Thu Mar 1 16:29:23 PST 2007



Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.102 -> 1.103
ScalarEvolutionExpander.cpp updated: 1.14 -> 1.15
---
Log message:

Prefer non-virtual calls to ConstantInt::isZero over virtual calls to 
Constant::isNullValue() in situations where it is possible.


---
Diffs of the changes:  (+7 -7)

 ScalarEvolution.cpp         |   12 ++++++------
 ScalarEvolutionExpander.cpp |    2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.102 llvm/lib/Analysis/ScalarEvolution.cpp:1.103
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.102	Thu Mar  1 16:28:51 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp	Thu Mar  1 18:28:51 2007
@@ -617,7 +617,7 @@
     }
 
     // If we are left with a constant zero being added, strip it off.
-    if (cast<SCEVConstant>(Ops[0])->getValue()->isNullValue()) {
+    if (cast<SCEVConstant>(Ops[0])->getValue()->isZero()) {
       Ops.erase(Ops.begin());
       --Idx;
     }
@@ -857,7 +857,7 @@
     if (cast<SCEVConstant>(Ops[0])->getValue()->equalsInt(1)) {
       Ops.erase(Ops.begin());
       --Idx;
-    } else if (cast<SCEVConstant>(Ops[0])->getValue()->isNullValue()) {
+    } else if (cast<SCEVConstant>(Ops[0])->getValue()->isZero()) {
       // If we have a multiply of zero, it will always be zero.
       return Ops[0];
     }
@@ -1026,7 +1026,7 @@
   if (Operands.size() == 1) return Operands[0];
 
   if (SCEVConstant *StepC = dyn_cast<SCEVConstant>(Operands.back()))
-    if (StepC->getValue()->isNullValue()) {
+    if (StepC->getValue()->isZero()) {
       Operands.pop_back();
       return get(Operands, L);             // { X,+,0 }  -->  X
     }
@@ -2124,7 +2124,7 @@
   // If the value is a constant
   if (SCEVConstant *C = dyn_cast<SCEVConstant>(V)) {
     // If the value is already zero, the branch will execute zero times.
-    if (C->getValue()->isNullValue()) return C;
+    if (C->getValue()->isZero()) return C;
     return UnknownValue;  // Otherwise it will loop infinitely.
   }
 
@@ -2187,7 +2187,7 @@
         // should not accept a root of 2.
         SCEVHandle Val = AddRec->evaluateAtIteration(R1);
         if (SCEVConstant *EvalVal = dyn_cast<SCEVConstant>(Val))
-          if (EvalVal->getValue()->isNullValue())
+          if (EvalVal->getValue()->isZero())
             return R1;  // We found a quadratic root!
       }
     }
@@ -2327,7 +2327,7 @@
 
   // If the start is a non-zero constant, shift the range to simplify things.
   if (SCEVConstant *SC = dyn_cast<SCEVConstant>(getStart()))
-    if (!SC->getValue()->isNullValue()) {
+    if (!SC->getValue()->isZero()) {
       std::vector<SCEVHandle> Operands(op_begin(), op_end());
       Operands[0] = SCEVUnknown::getIntegerSCEV(0, SC->getType());
       SCEVHandle Shifted = SCEVAddRecExpr::get(Operands, getLoop());


Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff -u llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.14 llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.15
--- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.14	Thu Mar  1 13:45:00 2007
+++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp	Thu Mar  1 18:28:51 2007
@@ -96,7 +96,7 @@
 
   // {X,+,F} --> X + {0,+,F}
   if (!isa<SCEVConstant>(S->getStart()) ||
-      !cast<SCEVConstant>(S->getStart())->getValue()->isNullValue()) {
+      !cast<SCEVConstant>(S->getStart())->getValue()->isZero()) {
     Value *Start = expandInTy(S->getStart(), Ty);
     std::vector<SCEVHandle> NewOps(S->op_begin(), S->op_end());
     NewOps[0] = SCEVUnknown::getIntegerSCEV(0, Ty);






More information about the llvm-commits mailing list