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

Dan Gohman gohman at apple.com
Sat Feb 13 19:21:49 PST 2010


Author: djg
Date: Sat Feb 13 21:21:49 2010
New Revision: 96152

URL: http://llvm.org/viewvc/llvm-project?rev=96152&view=rev
Log:
Actually, this code doesn't have to be quite so conservative in
the no-TLI case. But it should still default to declining the
transformation.

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=96152&r1=96151&r2=96152&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sat Feb 13 21:21:49 2010
@@ -1503,11 +1503,7 @@
 
     // Conservatively avoid trying to use the post-inc value in non-latch
     // exits if there may be pre-inc users in intervening blocks.
-    if (LatchBlock != ExitingBlock) {
-      // Without target lowering, we won't be able to query about valid reuse.
-      if (!TLI)
-        continue;
-
+    if (LatchBlock != ExitingBlock)
       for (IVUsers::const_iterator UI = IU.begin(), E = IU.end(); UI != E; ++UI)
         // Test if the use is reachable from the exiting block. This dominator
         // query is a conservative approximation of reachability.
@@ -1535,6 +1531,10 @@
             if (D->getValue()->getValue().getMinSignedBits() >= 64 ||
                 D->getValue()->getValue().isMinSignedValue())
               goto decline_post_inc;
+            // Without TLI, assume that any stride might be valid, and so any
+            // use might be shared.
+            if (!TLI)
+              goto decline_post_inc;
             // Check for possible scaled-address reuse.
             const Type *AccessTy = getAccessType(UI->getUser());
             TargetLowering::AddrMode AM;
@@ -1546,7 +1546,6 @@
               goto decline_post_inc;
           }
         }
-    }
 
     DEBUG(dbgs() << "  Change loop exiting icmp to use postinc iv: "
                  << *Cond << '\n');





More information about the llvm-commits mailing list