[PATCH] D55373: [LSR] Generate formulae to enable more post-incs

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 12 01:09:20 PST 2018


samparker marked 2 inline comments as done.
samparker added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:3793
+
+  if (TTI.shouldFavorPostInc()) {
+    if (auto *GAddRec = dyn_cast<SCEVAddRecExpr>(G)) {
----------------
gilr wrote:
> gilr wrote:
> > Is this relevant for non-Address kind formulae?
> Worth a comment here to describe the motivation and how adjusting the offset generates the post-inc opportunity.
No. I had naively assumed that this function was only generating formulae for addresses... so if that's not the case, I'll make the change here.


================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:3795
+    if (auto *GAddRec = dyn_cast<SCEVAddRecExpr>(G)) {
+      if (auto *StepSCEV = GetConstantStart(GAddRec->getStepRecurrence(SE))) {
+        const APInt &StepInt = StepSCEV->getAPInt();
----------------
gilr wrote:
> How does a non-constant step (e.g. 50 + %x) translate to post-inc? Could you add such a test case?
Ah, good catch. This should only trigger for constant steps.


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

https://reviews.llvm.org/D55373





More information about the llvm-commits mailing list