LSR, one of the new Cost::isLoser() checks did not get merged in the previous checkin.
authorAndrew Trick <atrick@apple.com>
Mon, 26 Sep 2011 23:35:25 +0000 (23:35 +0000)
committerAndrew Trick <atrick@apple.com>
Mon, 26 Sep 2011 23:35:25 +0000 (23:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140583 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 1e5b56bc4e28f9e90d7f60c2bade35450d76263a..0ad9fc384110269be413043baa0088d59979cea0 100644 (file)
@@ -745,9 +745,13 @@ void Cost::RateRegister(const SCEV *Reg,
 
     // Add the step value register, if it needs one.
     // TODO: The non-affine case isn't precisely modeled here.
-    if (!AR->isAffine() || !isa<SCEVConstant>(AR->getOperand(1)))
-      if (!Regs.count(AR->getOperand(1)))
+    if (!AR->isAffine() || !isa<SCEVConstant>(AR->getOperand(1))) {
+      if (!Regs.count(AR->getOperand(1))) {
         RateRegister(AR->getOperand(1), Regs, L, SE, DT);
+        if (isLoser())
+          return;
+      }
+    }
   }
   ++NumRegs;