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

Dan Gohman gohman at apple.com
Thu Apr 16 15:35:57 PDT 2009


Author: djg
Date: Thu Apr 16 17:35:57 2009
New Revision: 69321

URL: http://llvm.org/viewvc/llvm-project?rev=69321&view=rev
Log:
Use TargetData::getTypeSizeInBits instead of getPrimitiveSizeInBits()
to get the correct answer for pointer types.

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=69321&r1=69320&r2=69321&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Thu Apr 16 17:35:57 2009
@@ -1868,14 +1868,14 @@
         // it here.
         if (!ReuseIV.Base->isZero()) {
           SCEVHandle typedBase = ReuseIV.Base;
-          if (RewriteExpr->getType()->getPrimitiveSizeInBits() !=
-              ReuseIV.Base->getType()->getPrimitiveSizeInBits()) {
+          if (TD->getTypeSizeInBits(RewriteExpr->getType()) !=
+              TD->getTypeSizeInBits(ReuseIV.Base->getType())) {
             // It's possible the original IV is a larger type than the new IV,
             // in which case we have to truncate the Base.  We checked in
             // RequiresTypeConversion that this is valid.
-            assert (RewriteExpr->getType()->getPrimitiveSizeInBits() <
-                    ReuseIV.Base->getType()->getPrimitiveSizeInBits() &&
-                    "Unexpected lengthening conversion!");
+            assert(TD->getTypeSizeInBits(RewriteExpr->getType()) <
+                   TD->getTypeSizeInBits(ReuseIV.Base->getType()) &&
+                   "Unexpected lengthening conversion!");
             typedBase = SE->getTruncateExpr(ReuseIV.Base, 
                                             RewriteExpr->getType());
           }





More information about the llvm-commits mailing list