[PATCH] D156610: [WIP][LSR] Transform div instruction to add in loop

LuoYuanke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 31 00:07:47 PDT 2023


LuoYuanke added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:2254
+///   if (i == KW) {
+///     ++div;
+///     i = 0;
----------------
craig.topper wrote:
> Does `div` here replace the original `i`?
Yes, I'll update the code of the comments to make it clear.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:2288
+    // TODO, support negative and non-one positive step
+    const SCEV *One = SE.getConstant(BackedgeTakenCount->getType(), 1);
+    if (AR->getStepRecurrence(SE) != One)
----------------
craig.topper wrote:
> Do we need to create new SCEV expression to compare? Can we ask if the StepRecurrence is a SCEVConstant and get it's value?
Yes, we can just ask if StepRecurrence is one value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156610



More information about the llvm-commits mailing list