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

Reid Spencer reid at x10sys.com
Thu Oct 19 17:35:19 PDT 2006



Changes in directory llvm/lib/Analysis:

BasicAliasAnalysis.cpp updated: 1.86.2.1 -> 1.86.2.2
ConstantRange.cpp updated: 1.15.2.1 -> 1.15.2.2
ScalarEvolution.cpp updated: 1.53.2.1 -> 1.53.2.2
ScalarEvolutionExpander.cpp updated: 1.3 -> 1.3.6.1
---
Log message:

Make some simplifications for ConstantInt:
1. Get rid of getRawValue, replace with getZExtValue
2. Single constructor (uint64_t) and get method (int64_t)
3. Canonicalize the constant to a zero extended unsigned 64-bit integer when
   it is created.
4. Adjust getZExtValue() to be a do-nothing (just returns the already
   canonicalized value).
5. Compensate for above changes everywhere else.


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

 BasicAliasAnalysis.cpp      |    4 ++--
 ConstantRange.cpp           |    2 +-
 ScalarEvolution.cpp         |    6 +++---
 ScalarEvolutionExpander.cpp |    2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)


Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.86.2.1 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.86.2.2
--- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.86.2.1	Wed Oct 18 22:57:55 2006
+++ llvm/lib/Analysis/BasicAliasAnalysis.cpp	Thu Oct 19 19:34:43 2006
@@ -669,7 +669,7 @@
         if (const ConstantInt *Op1C = dyn_cast<ConstantInt>(Op1)) {
           // If this is an array index, make sure the array element is in range.
           if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty))
-            if (Op1C->getRawValue() >= AT->getNumElements())
+            if (Op1C->getZExtValue() >= AT->getNumElements())
               return MayAlias;  // Be conservative with out-of-range accesses
 
         } else {
@@ -692,7 +692,7 @@
         if (const ConstantInt *Op2C = dyn_cast<ConstantInt>(Op2)) {
           // If this is an array index, make sure the array element is in range.
           if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty))
-            if (Op2C->getRawValue() >= AT->getNumElements())
+            if (Op2C->getZExtValue() >= AT->getNumElements())
               return MayAlias;  // Be conservative with out-of-range accesses
         } else {  // Conservatively assume the minimum value for this index
           GEP2Ops[i] = Constant::getNullValue(Op2->getType());


Index: llvm/lib/Analysis/ConstantRange.cpp
diff -u llvm/lib/Analysis/ConstantRange.cpp:1.15.2.1 llvm/lib/Analysis/ConstantRange.cpp:1.15.2.2
--- llvm/lib/Analysis/ConstantRange.cpp:1.15.2.1	Wed Oct 18 22:57:55 2006
+++ llvm/lib/Analysis/ConstantRange.cpp	Thu Oct 19 19:34:43 2006
@@ -161,7 +161,7 @@
 
   // Simply subtract the bounds...
   Constant *Result = ConstantExpr::getSub(Upper, Lower);
-  return cast<ConstantInt>(Result)->getRawValue();
+  return cast<ConstantInt>(Result)->getZExtValue();
 }
 
 /// contains - Return true if the specified value is in the set.


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.1 llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.2
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.53.2.1	Wed Oct 18 22:57:55 2006
+++ llvm/lib/Analysis/ScalarEvolution.cpp	Thu Oct 19 19:34:43 2006
@@ -507,7 +507,7 @@
   // Handle this case efficiently, it is common to have constant iteration
   // counts while computing loop exit values.
   if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V)) {
-    uint64_t Val = SC->getValue()->getRawValue();
+    uint64_t Val = SC->getValue()->getZExtValue();
     uint64_t Result = 1;
     for (; NumSteps; --NumSteps)
       Result *= Val-(NumSteps-1);
@@ -1605,7 +1605,7 @@
                               const std::vector<ConstantInt*> &Indices) {
   Constant *Init = GV->getInitializer();
   for (unsigned i = 0, e = Indices.size(); i != e; ++i) {
-    uint64_t Idx = Indices[i]->getRawValue();
+    uint64_t Idx = Indices[i]->getZExtValue();
     if (ConstantStruct *CS = dyn_cast<ConstantStruct>(Init)) {
       assert(Idx < CS->getNumOperands() && "Bad struct index!");
       Init = cast<Constant>(CS->getOperand(Idx));
@@ -1935,7 +1935,7 @@
               // this is a constant evolving PHI node, get the final value at
               // the specified iteration number.
               Constant *RV = getConstantEvolutionLoopExitValue(PN,
-                                               ICC->getValue()->getRawValue(),
+                                               ICC->getValue()->getZExtValue(),
                                                                LI);
               if (RV) return SCEVUnknown::get(RV);
             }


Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff -u llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.3 llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.3.6.1
--- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.3	Sat Feb  4 03:51:53 2006
+++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp	Thu Oct 19 19:34:43 2006
@@ -144,7 +144,7 @@
     
     // IF the step is by one, just return the inserted IV.
     if (ConstantIntegral *CI = dyn_cast<ConstantIntegral>(F))
-      if (CI->getRawValue() == 1)
+      if (CI->getZExtValue() == 1)
         return I;
     
     // If the insert point is directly inside of the loop, emit the multiply at






More information about the llvm-commits mailing list