Charge a formula for explicit multiplies on scaled registers too,
authorDan Gohman <gohman@apple.com>
Thu, 7 Oct 2010 23:41:58 +0000 (23:41 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 7 Oct 2010 23:41:58 +0000 (23:41 +0000)
not just base registers.

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

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 4298b1c2e38c1dc72f19dd3b8cf7125acec0a6f4..b292ffec887e79cc0c309b27197e0d3638210586 100644 (file)
@@ -728,6 +728,9 @@ void Cost::RateRegister(const SCEV *Reg,
         (isa<SCEVUnknown>(cast<SCEVAddRecExpr>(Reg)->getStart()) ||
          isa<SCEVConstant>(cast<SCEVAddRecExpr>(Reg)->getStart()))))
     ++SetupCost;
+
+    NumIVMuls += isa<SCEVMulExpr>(Reg) &&
+                 Reg->hasComputableLoopEvolution(L);
 }
 
 /// RatePrimaryRegister - Record this register in the set. If we haven't seen it
@@ -762,9 +765,6 @@ void Cost::RateFormula(const Formula &F,
       return;
     }
     RatePrimaryRegister(BaseReg, Regs, L, SE, DT);
-
-    NumIVMuls += isa<SCEVMulExpr>(BaseReg) &&
-                 BaseReg->hasComputableLoopEvolution(L);
   }
 
   if (F.BaseRegs.size() > 1)