[llvm-commits] [llvm] r69296 - /llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Dan Gohman gohman at apple.com
Thu Apr 16 09:49:49 PDT 2009


Author: djg
Date: Thu Apr 16 11:49:48 2009
New Revision: 69296

URL: http://llvm.org/viewvc/llvm-project?rev=69296&view=rev
Log:
Minor code simplifications. Don't attempt LSR on theoretical
targets with pointers larger than 64 bits, due to the code not
yet being APInt clean.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=69296&r1=69295&r2=69296&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Thu Apr 16 11:49:48 2009
@@ -489,8 +489,7 @@
     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 @@
       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;
       }
 





More information about the llvm-commits mailing list