[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Reid Spencer reid at x10sys.com
Sun Jan 21 21:51:41 PST 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.607 -> 1.608
---
Log message:

Cleanup checks in the load and store of casted pointer transforms. Two
changes: (1) don't special case for i1 any more, (2) use the new 
TargetData::getTypeSizeInBits method to ensure source and dest are the 
same bit width.


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

 InstructionCombining.cpp |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.607 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.608
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.607	Sat Jan 20 17:35:48 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Sun Jan 21 23:51:25 2007
@@ -7990,8 +7990,8 @@
   if (const PointerType *SrcTy = dyn_cast<PointerType>(CastOp->getType())) {
     const Type *SrcPTy = SrcTy->getElementType();
 
-    if ((DestPTy->isInteger() && DestPTy != Type::Int1Ty) ||
-        isa<PointerType>(DestPTy) || isa<PackedType>(DestPTy)) {
+    if (DestPTy->isInteger() || isa<PointerType>(DestPTy) || 
+         isa<PackedType>(DestPTy)) {
       // If the source is an array, the code below will not succeed.  Check to
       // see if a trivial 'gep P, 0, 0' will help matters.  Only do this for
       // constants.
@@ -8004,13 +8004,13 @@
             SrcPTy = SrcTy->getElementType();
           }
 
-      if (((SrcPTy->isInteger() && SrcPTy != Type::Int1Ty) ||
-           isa<PointerType>(SrcPTy) || isa<PackedType>(SrcPTy)) &&
+      if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy) || 
+            isa<PackedType>(SrcPTy)) &&
           // Do not allow turning this into a load of an integer, which is then
           // casted to a pointer, this pessimizes pointer analysis a lot.
           (isa<PointerType>(SrcPTy) == isa<PointerType>(LI.getType())) &&
-          IC.getTargetData().getTypeSize(SrcPTy) ==
-               IC.getTargetData().getTypeSize(DestPTy)) {
+          IC.getTargetData().getTypeSizeInBits(SrcPTy) ==
+               IC.getTargetData().getTypeSizeInBits(DestPTy)) {
 
         // Okay, we are casting from one integer or pointer type to another of
         // the same size.  Instead of casting the pointer before the load, cast
@@ -8178,8 +8178,7 @@
   if (const PointerType *SrcTy = dyn_cast<PointerType>(CastOp->getType())) {
     const Type *SrcPTy = SrcTy->getElementType();
 
-    if ((DestPTy->isInteger() && DestPTy != Type::Int1Ty) ||
-        isa<PointerType>(DestPTy)) {
+    if (DestPTy->isInteger() || isa<PointerType>(DestPTy)) {
       // If the source is an array, the code below will not succeed.  Check to
       // see if a trivial 'gep P, 0, 0' will help matters.  Only do this for
       // constants.






More information about the llvm-commits mailing list