[llvm-commits] [llvm] r64530 - /llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Dan Gohman gohman at apple.com
Fri Feb 13 18:25:20 PST 2009


Author: djg
Date: Fri Feb 13 20:25:19 2009
New Revision: 64530

URL: http://llvm.org/viewvc/llvm-project?rev=64530&view=rev
Log:
Simplify some code. hasComputableLoopEvolution is overkill in this case.
No functionality change.

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

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

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Fri Feb 13 20:25:19 2009
@@ -551,15 +551,14 @@
     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));
     }
   }
 





More information about the llvm-commits mailing list