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

Reid Spencer reid at x10sys.com
Thu Jan 11 20:25:22 PST 2007



Changes in directory llvm/lib/Analysis:

BasicAliasAnalysis.cpp updated: 1.98 -> 1.99
ConstantRange.cpp updated: 1.27 -> 1.28
ScalarEvolution.cpp updated: 1.83 -> 1.84
---
Log message:

Implement review feedback for the ConstantBool->ConstantInt merge. Chris
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.


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

 BasicAliasAnalysis.cpp |    2 +-
 ConstantRange.cpp      |    6 +++---
 ScalarEvolution.cpp    |    8 ++++----
 3 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.98 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.99
--- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.98	Thu Jan 11 12:21:28 2007
+++ llvm/lib/Analysis/BasicAliasAnalysis.cpp	Thu Jan 11 22:24:45 2007
@@ -586,7 +586,7 @@
               Constant *Compare = ConstantExpr::getICmp(ICmpInst::ICMP_SGT, 
                                                         G1OC, G2OC);
               if (ConstantInt *CV = dyn_cast<ConstantInt>(Compare)) {
-                if (CV->getBoolValue())   // If they are comparable and G2 > G1
+                if (CV->getZExtValue())   // If they are comparable and G2 > G1
                   std::swap(GEP1Ops, GEP2Ops);  // Make GEP1 < GEP2
                 break;
               }


Index: llvm/lib/Analysis/ConstantRange.cpp
diff -u llvm/lib/Analysis/ConstantRange.cpp:1.27 llvm/lib/Analysis/ConstantRange.cpp:1.28
--- llvm/lib/Analysis/ConstantRange.cpp:1.27	Thu Jan 11 12:21:28 2007
+++ llvm/lib/Analysis/ConstantRange.cpp	Thu Jan 11 22:24:45 2007
@@ -64,7 +64,7 @@
 }
 static ConstantInt *Next(ConstantInt *CI) {
   if (CI->getType() == Type::Int1Ty)
-    return ConstantInt::get(!CI->getBoolValue());
+    return ConstantInt::get(Type::Int1Ty, !CI->getZExtValue());
 
   Constant *Result = ConstantExpr::getAdd(CI,
                                           ConstantInt::get(CI->getType(), 1));
@@ -75,14 +75,14 @@
   Constant *C = ConstantExpr::getICmp(
     (isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT), A, B);
   assert(isa<ConstantInt>(C) && "Constant folding of integrals not impl??");
-  return cast<ConstantInt>(C)->getBoolValue();
+  return cast<ConstantInt>(C)->getZExtValue();
 }
 
 static bool LTE(ConstantInt *A, ConstantInt *B, bool isSigned) {
   Constant *C = ConstantExpr::getICmp(
     (isSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE), A, B);
   assert(isa<ConstantInt>(C) && "Constant folding of integrals not impl??");
-  return cast<ConstantInt>(C)->getBoolValue();
+  return cast<ConstantInt>(C)->getZExtValue();
 }
 
 static bool GT(ConstantInt *A, ConstantInt *B, bool isSigned) { 


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.83 llvm/lib/Analysis/ScalarEvolution.cpp:1.84
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.83	Thu Jan 11 12:21:28 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp	Thu Jan 11 22:24:45 2007
@@ -1722,7 +1722,7 @@
     // Evaluate the condition for this iteration.
     Result = ConstantExpr::getICmp(predicate, Result, RHS);
     if (!isa<ConstantInt>(Result)) break;  // Couldn't decide for sure
-    if (cast<ConstantInt>(Result)->getBoolValue() == false) {
+    if (cast<ConstantInt>(Result)->getZExtValue() == false) {
 #if 0
       cerr << "\n***\n*** Computed loop count " << *ItCst
            << "\n*** From global " << *GV << "*** BB: " << *L->getHeader()
@@ -1932,7 +1932,7 @@
     // Couldn't symbolically evaluate.
     if (!CondVal || CondVal->getType() != Type::Int1Ty) return UnknownValue;
 
-    if (CondVal->getBoolValue() == ExitWhen) {
+    if (CondVal->getZExtValue() == ExitWhen) {
       ConstantEvolutionLoopExitValue[PN] = PHIVal;
       ++NumBruteForceTripCountsComputed;
       return SCEVConstant::get(ConstantInt::get(Type::Int32Ty, IterationNum));
@@ -2204,7 +2204,7 @@
       if (ConstantInt *CB =
           dyn_cast<ConstantInt>(ConstantExpr::getICmp(ICmpInst::ICMP_ULT, 
                                    R1->getValue(), R2->getValue()))) {
-        if (CB->getBoolValue() == false)
+        if (CB->getZExtValue() == false)
           std::swap(R1, R2);   // R1 is the minimum root now.
 
         // We can only use this value if the chrec ends up with an exact zero
@@ -2429,7 +2429,7 @@
       if (ConstantInt *CB =
           dyn_cast<ConstantInt>(ConstantExpr::getICmp(ICmpInst::ICMP_ULT, 
                                    R1->getValue(), R2->getValue()))) {
-        if (CB->getBoolValue() == false)
+        if (CB->getZExtValue() == false)
           std::swap(R1, R2);   // R1 is the minimum root now.
 
         // Make sure the root is not off by one.  The returned iteration should






More information about the llvm-commits mailing list