Fix a regression in my isIntegral patch that broke 471.omnetpp. This is
authorChris Lattner <sabre@nondot.org>
Mon, 15 Jan 2007 17:55:20 +0000 (17:55 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 15 Jan 2007 17:55:20 +0000 (17:55 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33237 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index 04a6e83c063badf1bbcc3bcb69f831649811852b..f81f10e71e1e15df6a70e071ab85c88915d7f22f 100644 (file)
@@ -7978,8 +7978,8 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) {
   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 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) {
             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 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
   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 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
             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)) {