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

Reid Spencer reid at x10sys.com
Sun Jan 7 17:26:48 PST 2007



Changes in directory llvm/lib/Analysis:

ConstantRange.cpp updated: 1.23 -> 1.24
ScalarEvolution.cpp updated: 1.80 -> 1.81
---
Log message:

Convert uses of getPrimitiveSize that should be getPrimitiveSizeInBits.


---
Diffs of the changes:  (+14 -15)

 ConstantRange.cpp   |   17 ++++++++---------
 ScalarEvolution.cpp |   12 ++++++------
 2 files changed, 14 insertions(+), 15 deletions(-)


Index: llvm/lib/Analysis/ConstantRange.cpp
diff -u llvm/lib/Analysis/ConstantRange.cpp:1.23 llvm/lib/Analysis/ConstantRange.cpp:1.24
--- llvm/lib/Analysis/ConstantRange.cpp:1.23	Sat Dec 23 00:05:40 2006
+++ llvm/lib/Analysis/ConstantRange.cpp	Sun Jan  7 19:26:33 2007
@@ -36,7 +36,7 @@
   if (Ty->isInteger()) {
     if (isSigned) {
       // Calculate 011111111111111...
-      unsigned TypeBits = Ty->getPrimitiveSize()*8;
+      unsigned TypeBits = Ty->getPrimitiveSizeInBits();
       int64_t Val = INT64_MAX;             // All ones
       Val >>= 64-TypeBits;                 // Shift out unwanted 1 bits...
       return ConstantInt::get(Ty, Val);
@@ -53,7 +53,7 @@
   if (Ty->isInteger()) {
     if (isSigned) {
       // Calculate 1111111111000000000000
-      unsigned TypeBits = Ty->getPrimitiveSize()*8;
+      unsigned TypeBits = Ty->getPrimitiveSizeInBits();
       int64_t Val = -1;                    // All ones
       Val <<= TypeBits-1;                  // Shift over to the right spot
       return ConstantInt::get(Ty, Val);
@@ -334,13 +334,12 @@
 /// correspond to the possible range of values as if the source range had been
 /// zero extended.
 ConstantRange ConstantRange::zeroExtend(const Type *Ty) const {
-  assert(getLower()->getType()->getPrimitiveSize() < Ty->getPrimitiveSize() &&
-         "Not a value extension");
+  unsigned SrcTySize = getLower()->getType()->getPrimitiveSizeInBits();
+  assert(SrcTySize < Ty->getPrimitiveSizeInBits() && "Not a value extension");
   if (isFullSet()) {
     // Change a source full set into [0, 1 << 8*numbytes)
-    unsigned SrcTySize = getLower()->getType()->getPrimitiveSize();
     return ConstantRange(Constant::getNullValue(Ty),
-                         ConstantInt::get(Ty, 1ULL << SrcTySize*8));
+                         ConstantInt::get(Ty, 1ULL << SrcTySize));
   }
 
   Constant *Lower = getLower();
@@ -355,9 +354,9 @@
 /// correspond to the possible range of values as if the source range had been
 /// truncated to the specified type.
 ConstantRange ConstantRange::truncate(const Type *Ty) const {
-  assert(getLower()->getType()->getPrimitiveSize() > Ty->getPrimitiveSize() &&
-         "Not a value truncation");
-  uint64_t Size = 1ULL << Ty->getPrimitiveSize()*8;
+  unsigned SrcTySize = getLower()->getType()->getPrimitiveSizeInBits();
+  assert(SrcTySize > Ty->getPrimitiveSize() && "Not a value truncation");
+  uint64_t Size = 1ULL << Ty->getPrimitiveSizeInBits();
   if (isFullSet() || getSetSize() >= Size)
     return ConstantRange(getType());
 


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.80 llvm/lib/Analysis/ScalarEvolution.cpp:1.81
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.80	Sat Jan  6 20:24:26 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp	Sun Jan  7 19:26:33 2007
@@ -196,8 +196,8 @@
   : SCEV(scTruncate), Op(op), Ty(ty) {
   assert(Op->getType()->isInteger() && Ty->isInteger() &&
          "Cannot truncate non-integer value!");
-  assert(Op->getType()->getPrimitiveSize() > Ty->getPrimitiveSize() &&
-         "This is not a truncating conversion!");
+  assert(Op->getType()->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits()
+         && "This is not a truncating conversion!");
 }
 
 SCEVTruncateExpr::~SCEVTruncateExpr() {
@@ -222,8 +222,8 @@
   : SCEV(scZeroExtend), Op(op), Ty(ty) {
   assert(Op->getType()->isInteger() && Ty->isInteger() &&
          "Cannot zero extend non-integer value!");
-  assert(Op->getType()->getPrimitiveSize() < Ty->getPrimitiveSize() &&
-         "This is not an extending conversion!");
+  assert(Op->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()
+         && "This is not an extending conversion!");
 }
 
 SCEVZeroExtendExpr::~SCEVZeroExtendExpr() {
@@ -461,9 +461,9 @@
   const Type *SrcTy = V->getType();
   assert(SrcTy->isInteger() && Ty->isInteger() &&
          "Cannot truncate or zero extend with non-integer arguments!");
-  if (SrcTy->getPrimitiveSize() == Ty->getPrimitiveSize())
+  if (SrcTy->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits())
     return V;  // No conversion
-  if (SrcTy->getPrimitiveSize() > Ty->getPrimitiveSize())
+  if (SrcTy->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits())
     return SCEVTruncateExpr::get(V, Ty);
   return SCEVZeroExtendExpr::get(V, Ty);
 }






More information about the llvm-commits mailing list