Changes in directory llvm/lib/Transforms/Scalar:

IndVarSimplify.cpp updated: 1.101 -> 1.102
InstructionCombining.cpp updated: 1.586 -> 1.587
ScalarReplAggregates.cpp updated: 1.62 -> 1.63
---
Log message:

Comparison of primitive type sizes should now be done in bits, not bytes.
This patch converts getPrimitiveSize to getPrimitiveSizeInBits where it is
appropriate to do so (comparison of integer primitive types).


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

 IndVarSimplify.cpp       |    5 +++--
 InstructionCombining.cpp |   17 +++++++++--------
 ScalarReplAggregates.cpp |    4 ++--
 3 files changed, 14 insertions(+), 12 deletions(-)


Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.101 
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.102
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.101 Sat Jan  6 19:14:12 2007
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp       Mon Jan  8 10:32:00 2007
@@ -498,8 +498,9 @@
   bool DifferingSizes = false;
   for (unsigned i = 1, e = IndVars.size(); i != e; ++i) {
     const Type *Ty = IndVars[i].first->getType();
-    DifferingSizes |= Ty->getPrimitiveSize() != 
LargestType->getPrimitiveSize();
-    if (Ty->getPrimitiveSize() > LargestType->getPrimitiveSize())
+    DifferingSizes |= 
+      Ty->getPrimitiveSizeInBits() != LargestType->getPrimitiveSizeInBits();
+    if (Ty->getPrimitiveSizeInBits() > LargestType->getPrimitiveSizeInBits())
       LargestType = Ty;
   }
 


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.586 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.587
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.586   Sun Jan  7 
00:58:05 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jan  8 10:32:00 2007
@@ -1926,8 +1926,8 @@
       Other = LHS;
     }
     if (CI && CI->getType()->isSized() && 
-        (CI->getType()->getPrimitiveSize() == 
-         TD->getIntPtrType()->getPrimitiveSize()) 
+        (CI->getType()->getPrimitiveSizeInBits() == 
+         TD->getIntPtrType()->getPrimitiveSizeInBits()) 
         && isa<PointerType>(CI->getOperand(0)->getType())) {
       Value *I2 = InsertCastBefore(Instruction::BitCast, CI->getOperand(0),
                                    PointerType::get(Type::Int8Ty), I);
@@ -7239,9 +7239,9 @@
     bool isConvertible = ActTy == ParamTy ||
       (isa<PointerType>(ParamTy) && isa<PointerType>(ActTy)) ||
       (ParamTy->isIntegral() && ActTy->isIntegral() &&
-       ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize()) ||
-      (c && ParamTy->getPrimitiveSize() >= ActTy->getPrimitiveSize() &&
-       c->getSExtValue() > 0);
+       ParamTy->getPrimitiveSizeInBits() >= ActTy->getPrimitiveSizeInBits()) ||
+      (c && ParamTy->getPrimitiveSizeInBits() >= 
ActTy->getPrimitiveSizeInBits()
+       && c->getSExtValue() > 0);
     if (Callee->isExternal() && !isConvertible) return false;
   }
 
@@ -7594,8 +7594,8 @@
 static Value *InsertCastToIntPtrTy(Value *V, const Type *DTy,
                                    Instruction *InsertPoint,
                                    InstCombiner *IC) {
-  unsigned PtrSize = DTy->getPrimitiveSize();
-  unsigned VTySize = V->getType()->getPrimitiveSize();
+  unsigned PtrSize = DTy->getPrimitiveSizeInBits();
+  unsigned VTySize = V->getType()->getPrimitiveSizeInBits();
   // We must cast correctly to the pointer type. Ensure that we
   // sign extend the integer value if it is smaller as this is
   // used for address computation.
@@ -7642,7 +7642,8 @@
               MadeChange = true;
               GEP.setOperand(i, Src);
             }
-          } else if (SrcTy->getPrimitiveSize() < DestTy->getPrimitiveSize() &&
+          } else if (SrcTy->getPrimitiveSizeInBits() < 
+                     DestTy->getPrimitiveSizeInBits() &&
                      SrcTy->getPrimitiveSize() == 4) {
             // We can eliminate a cast from [u]int to [u]long iff the target 
             // is a 32-bit pointer target.


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.62 
llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.63
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.62    Sat Dec 30 
23:48:39 2006
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Jan  8 10:32:00 2007
@@ -665,8 +665,8 @@
                                                 LI->getName(), LI);
           } else if (LI->getType()->isFloatingPoint()) {
             // If needed, truncate the integer to the appropriate size.
-            if (NV->getType()->getPrimitiveSize() > 
-                LI->getType()->getPrimitiveSize()) {
+            if (NV->getType()->getPrimitiveSizeInBits() > 
+                LI->getType()->getPrimitiveSizeInBits()) {
               switch (LI->getType()->getTypeID()) {
               default: assert(0 && "Unknown FP type!");
               case Type::FloatTyID:



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to