Simplify some code. hasComputableLoopEvolution is overkill in this case.
authorDan Gohman <gohman@apple.com>
Sat, 14 Feb 2009 02:25:19 +0000 (02:25 +0000)
committerDan Gohman <gohman@apple.com>
Sat, 14 Feb 2009 02:25:19 +0000 (02:25 +0000)
No functionality change.

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

lib/Transforms/Scalar/IndVarSimplify.cpp

index ccd25d8fb50170d6d89f1c83edd1be9e48ea25ef..238505167877fe42311b937890ce1d42dde0b943 100644 (file)
@@ -551,15 +551,14 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
     PHINode *PN = cast<PHINode>(I);
     if (PN->getType()->isInteger()) { // FIXME: when we have fast-math, enable!
       SCEVHandle SCEV = SE->getSCEV(PN);
-      if (SCEV->hasComputableLoopEvolution(L))
-        // FIXME: It is an extremely bad idea to indvar substitute anything more
-        // complex than affine induction variables.  Doing so will put expensive
-        // polynomial evaluations inside of the loop, and the str reduction pass
-        // currently can only reduce affine polynomials.  For now just disable
-        // indvar subst on anything more complex than an affine addrec.
-        if (SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SCEV))
-          if (AR->isAffine())
-            IndVars.push_back(std::make_pair(PN, SCEV));
+      // FIXME: It is an extremely bad idea to indvar substitute anything more
+      // complex than affine induction variables.  Doing so will put expensive
+      // polynomial evaluations inside of the loop, and the str reduction pass
+      // currently can only reduce affine polynomials.  For now just disable
+      // indvar subst on anything more complex than an affine addrec.
+      if (SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SCEV))
+        if (AR->getLoop() == L && AR->isAffine())
+          IndVars.push_back(std::make_pair(PN, SCEV));
     }
   }