[PATCH] D58770: [LSR] Attempt to increase the accuracy of LSR's setup cost

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 01:21:56 PST 2019


samparker added a comment.

Hi Dave,

Is the lsr-setupcost test new? I don't see it in my working directory.



================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:1224
+    return getSetupCost(S->getStart());
+  if (!EnableRecursiveSetupCost)
+    return 0;
----------------
Shouldn't we have this before the first recursive call?


================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:1303
   // instructions in the preheader.
-  if (!isa<SCEVUnknown>(Reg) &&
-      !isa<SCEVConstant>(Reg) &&
-      !(isa<SCEVAddRecExpr>(Reg) &&
-        (isa<SCEVUnknown>(cast<SCEVAddRecExpr>(Reg)->getStart()) ||
-         isa<SCEVConstant>(cast<SCEVAddRecExpr>(Reg)->getStart()))))
-    ++C.SetupCost;
+  C.SetupCost += getSetupCost(Reg);
 
----------------
Use a lamda instead?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58770/new/

https://reviews.llvm.org/D58770





More information about the llvm-commits mailing list