indvars -disable-iv-rewrite: run RLEV after SimplifyIVUsers for
authorAndrew Trick <atrick@apple.com>
Mon, 27 Jun 2011 23:17:44 +0000 (23:17 +0000)
committerAndrew Trick <atrick@apple.com>
Mon, 27 Jun 2011 23:17:44 +0000 (23:17 +0000)
a bit more control over the order SCEVs are evaluated.

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

lib/Transforms/Scalar/IndVarSimplify.cpp

index 1d793394728d7f9800d1de1f297027d56a939940..1a87b15e7fc382b6c8ab3a008598c63273f11c0f 100644 (file)
@@ -1158,8 +1158,12 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
 
   // Create a rewriter object which we'll use to transform the code with.
   SCEVExpander Rewriter(*SE);
-  if (DisableIVRewrite)
+
+  // Eliminate redundant IV users.
+  if (DisableIVRewrite) {
     Rewriter.disableCanonicalMode();
+    SimplifyIVUsersNoRewrite(L, Rewriter);
+  }
 
   // Check to see if this loop has a computable loop-invariant execution count.
   // If so, this means that we can compute the final value of any expressions
@@ -1171,9 +1175,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
     RewriteLoopExitValues(L, Rewriter);
 
   // Eliminate redundant IV users.
-  if (DisableIVRewrite)
-    SimplifyIVUsersNoRewrite(L, Rewriter);
-  else
+  if (!DisableIVRewrite)
     SimplifyIVUsers(Rewriter);
 
   // Compute the type of the largest recurrence expression, and decide whether