[PATCH] D113183: [LV] Patch up induction phis after VPlan execution.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 25 04:15:10 PST 2021


fhahn updated this revision to Diff 389735.
fhahn marked 2 inline comments as done.
fhahn added a comment.

Addressed comments and added a few additional code comments.

In D113183#3153076 <https://reviews.llvm.org/D113183#3153076>, @Ayal wrote:

> 



> Yes, in order to sink LastInduction it should be wrapped in a recipe by itself, separating it from VPWidenIntOrFpInductionRecipe. Would introducing such a LastInduction recipe here, potentially created in FixHeaderPhis out of its feeding/consuming VPWidenIntOrFpInductionRecipe, be simpler for this patch? It needs only to take of

I had a look, but unfortunately I don't think this is feasible additional work. The step increment value depends on the induction descriptor and may need to be expanded from a SCEV expression in the pre-header. Once we can model the preheader in VPlan, we can add a recipe in the preheader to create the step value.

Alternatively we could land D111303 <https://reviews.llvm.org/D111303> first, which expands the step up front and maps it to a VPValue that can be used by the induction recipes. Please let me know if you prefer that direction.

A further complication is that LastInduction is also set for `CastDef`.

>   LastInduction = cast<Instruction>(
>       Builder.CreateBinOp(AddOp, LastInduction, SplatVF, "step.add"));
>   LastInduction->setDebugLoc(EntryVal->getDebugLoc());
>
> keeping VPWidenIntOrFpInductionRecipe with a single value Def.

Unfortunately VPWidenIntOrFpInductionRecipe is already a multi-def in some cases (due to handling casts as well).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113183

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPlan.cpp
  llvm/lib/Transforms/Vectorize/VPlan.h
  llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113183.389735.patch
Type: text/x-patch
Size: 9999 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211125/052b8ced/attachment.bin>


More information about the llvm-commits mailing list