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

Chris Lattner sabre at nondot.org
Mon Jan 15 09:55:38 PST 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.600 -> 1.601
---
Log message:

Fix a regression in my isIntegral patch that broke 471.omnetpp.  This is 
because TargetData::getTypeSize() returns the same for i1 and i8.  This fix
is not right for the full generality of bitwise types, but it fixes the
regression.


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

 InstructionCombining.cpp |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.600 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.601
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.600	Mon Jan 15 01:30:06 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Jan 15 11:55:20 2007
@@ -7978,8 +7978,8 @@
   if (const PointerType *SrcTy = dyn_cast<PointerType>(CastOp->getType())) {
     const Type *SrcPTy = SrcTy->getElementType();
 
-    if (DestPTy->isInteger() || isa<PointerType>(DestPTy) || 
-        isa<PackedType>(DestPTy)) {
+    if ((DestPTy->isInteger() && DestPTy != Type::Int1Ty) ||
+        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.
@@ -7992,8 +7992,8 @@
             SrcPTy = SrcTy->getElementType();
           }
 
-      if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy) || 
-           isa<PackedType>(SrcPTy)) &&
+      if (((SrcPTy->isInteger() && SrcPTy != Type::Int1Ty) ||
+           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())) &&
@@ -8166,7 +8166,8 @@
   if (const PointerType *SrcTy = dyn_cast<PointerType>(CastOp->getType())) {
     const Type *SrcPTy = SrcTy->getElementType();
 
-    if (DestPTy->isInteger() || isa<PointerType>(DestPTy)) {
+    if ((DestPTy->isInteger() && DestPTy != Type::Int1Ty) ||
+        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.
@@ -8179,7 +8180,8 @@
             SrcPTy = SrcTy->getElementType();
           }
 
-      if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy)) &&
+      if (((SrcPTy->isInteger() && SrcPTy != Type::Int1Ty) ||
+           isa<PointerType>(SrcPTy)) &&
           IC.getTargetData().getTypeSize(SrcPTy) ==
                IC.getTargetData().getTypeSize(DestPTy)) {
 






More information about the llvm-commits mailing list