Minor code simplifications. Don't attempt LSR on theoretical
authorDan Gohman <gohman@apple.com>
Thu, 16 Apr 2009 16:49:48 +0000 (16:49 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 16 Apr 2009 16:49:48 +0000 (16:49 +0000)
targets with pointers larger than 64 bits, due to the code not
yet being APInt clean.

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

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 957582817a4cacffda409c84d28e65be5fc77966..733f37c20743c96876cbe461a10729bda71e6f8e 100644 (file)
@@ -489,8 +489,7 @@ bool LoopStrengthReduce::AddUsersIfInteresting(Instruction *I, Loop *L,
     return false;   // Void and FP expressions cannot be reduced.
 
   // LSR is not APInt clean, do not touch integers bigger than 64-bits.
-  if (I->getType()->isInteger() && 
-      I->getType()->getPrimitiveSizeInBits() > 64)
+  if (TD->getTypeSizeInBits(I->getType()) > 64)
     return false;
   
   if (!Processed.insert(I))
@@ -2075,16 +2074,11 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond,
       if (RequiresTypeConversion(NewCmpTy, CmpTy)) {
         // Check if it is possible to rewrite it using
         // an iv / stride of a smaller integer type.
-        bool TruncOk = false;
-        if (NewCmpTy->isInteger()) {
-          unsigned Bits = NewTyBits;
-          if (ICmpInst::isSignedPredicate(Predicate))
-            --Bits;
-          uint64_t Mask = (1ULL << Bits) - 1;
-          if (((uint64_t)NewCmpVal & Mask) == (uint64_t)NewCmpVal)
-            TruncOk = true;
-        }
-        if (!TruncOk)
+        unsigned Bits = NewTyBits;
+        if (ICmpInst::isSignedPredicate(Predicate))
+          --Bits;
+        uint64_t Mask = (1ULL << Bits) - 1;
+        if (((uint64_t)NewCmpVal & Mask) != (uint64_t)NewCmpVal)
           continue;
       }