[PATCH] D157401: [VPlan] Replace CalculateTripCountMinusVF with explicit VPInstructions (WIP).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 08:10:45 PDT 2023


fhahn created this revision.
fhahn added reviewers: gilr, Ayal, rengolin.
Herald added subscribers: StephenFan, tschuett, psnobl, rogfer01, zzheng, bollu, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added subscribers: wangpc, vkmr.
Herald added a project: LLVM.

Building on the added RuntimeVFxUF, replace the CalculateTripCountMinusVF
opcode with explicit Sub,Cmp & Select VPInstructions to compute the trip
count minus 1. This removes a very specific opcode and allows re-using
the already computed VFxUF.

Note that this highlights an existing challenge with using VPInstruction to
model computation in the vector preheaders: when using VPInstruction to
compute scalar values outside a vector loop, we may have to explicitly
access VPIteration(0, 0) when retrieving the corresponding value from
state.

The reason for that is that some recipes in the preheader must
explicitly set VPIteration(0, 0) because some of their users in the
vector loop may need to access a vector with lane 0 broadcasted (e.g.
trip count for tail folding top-level mask compare). For now this patch
works around this by checking if the VPInstruction has a parent region.
Should we generalize this for all opcodes in generateInstruction?

Note: A number of tests still need updating.

Depends on D157322 <https://reviews.llvm.org/D157322>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157401

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPlan.cpp
  llvm/lib/Transforms/Vectorize/VPlan.h
  llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
  llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-forced.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-unroll.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157401.548236.patch
Type: text/x-patch
Size: 148566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230808/27f52d64/attachment-0001.bin>


More information about the llvm-commits mailing list