[PATCH] D158332: [LV] Use IRBuilder to create and optimize middle-block compare.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 28 06:37:53 PDT 2023


fhahn updated this revision to Diff 553913.
fhahn added a comment.

In D158332#4620180 <https://reviews.llvm.org/D158332#4620180>, @Ayal wrote:

> Rather than have IRBuilder detect and optimize this implicitly at code-gen/ILV::completeLoopSkeleton() time, better do so explicitly at VPlan transform time, probably after VF and UF have been set, i.e., optimize the compare and conditional branch recipes into an unconditional branch recipe. Is the intent to do so as a subsequent patch? If so would be good to add a TODO to replace IRBuilder here; code-gen should ideally be straightforward.

The immediate goal is to bring this code in line with how VPInstruction creates compares, so the diff for D150398 <https://reviews.llvm.org/D150398> is as small as possible.

Once we have the branch modeled in VPlan, we should simplify it there directly as well, but this  patch is a first step to get there, I added a TODO.

> nit: typo in title. The use of IRBuilder to create the compare also optimizes it.

Typo should be fixed, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158332

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/AArch64/epilog-vectorization-widen-inductions.ll
  llvm/test/Transforms/LoopVectorize/AArch64/pr60831-sve-inv-store-crash.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect.ll
  llvm/test/Transforms/LoopVectorize/AArch64/synthesize-mask-for-call.ll
  llvm/test/Transforms/LoopVectorize/AArch64/type-shrinkage-insertelt.ll
  llvm/test/Transforms/LoopVectorize/ARM/tail-folding-not-allowed.ll
  llvm/test/Transforms/LoopVectorize/RISCV/divrem.ll
  llvm/test/Transforms/LoopVectorize/RISCV/interleaved-accesses.ll
  llvm/test/Transforms/LoopVectorize/RISCV/safe-dep-distance.ll
  llvm/test/Transforms/LoopVectorize/RISCV/short-trip-count.ll
  llvm/test/Transforms/LoopVectorize/RISCV/uniform-load-store.ll
  llvm/test/Transforms/LoopVectorize/X86/constant-fold.ll
  llvm/test/Transforms/LoopVectorize/X86/gather_scatter.ll
  llvm/test/Transforms/LoopVectorize/X86/imprecise-through-phis.ll
  llvm/test/Transforms/LoopVectorize/X86/limit-vf-by-tripcount.ll
  llvm/test/Transforms/LoopVectorize/X86/load-deref-pred.ll
  llvm/test/Transforms/LoopVectorize/X86/masked_load_store.ll
  llvm/test/Transforms/LoopVectorize/X86/metadata-enable.ll
  llvm/test/Transforms/LoopVectorize/X86/optsize.ll
  llvm/test/Transforms/LoopVectorize/X86/pr34438.ll
  llvm/test/Transforms/LoopVectorize/X86/pr36524.ll
  llvm/test/Transforms/LoopVectorize/X86/pr51366-sunk-instruction-used-outside-of-loop.ll
  llvm/test/Transforms/LoopVectorize/X86/reduction-fastmath.ll
  llvm/test/Transforms/LoopVectorize/X86/strided_load_cost.ll
  llvm/test/Transforms/LoopVectorize/X86/uniform_mem_op.ll
  llvm/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll
  llvm/test/Transforms/LoopVectorize/X86/x86-predication.ll
  llvm/test/Transforms/LoopVectorize/create-induction-resume.ll
  llvm/test/Transforms/LoopVectorize/dont-fold-tail-for-const-TC.ll
  llvm/test/Transforms/LoopVectorize/epilog-vectorization-reductions.ll
  llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains.ll
  llvm/test/Transforms/LoopVectorize/first-order-recurrence-complex.ll
  llvm/test/Transforms/LoopVectorize/first-order-recurrence-multiply-recurrences.ll
  llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll
  llvm/test/Transforms/LoopVectorize/float-minmax-instruction-flag.ll
  llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll
  llvm/test/Transforms/LoopVectorize/if-pred-stores.ll
  llvm/test/Transforms/LoopVectorize/induction-multiple-uses-in-same-instruction.ll
  llvm/test/Transforms/LoopVectorize/induction.ll
  llvm/test/Transforms/LoopVectorize/instruction-only-used-outside-of-loop.ll
  llvm/test/Transforms/LoopVectorize/is_fpclass.ll
  llvm/test/Transforms/LoopVectorize/lcssa-crashes.ll
  llvm/test/Transforms/LoopVectorize/load-deref-pred-align.ll
  llvm/test/Transforms/LoopVectorize/load-of-struct-deref-pred.ll
  llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization.ll
  llvm/test/Transforms/LoopVectorize/pointer-induction-unroll.ll
  llvm/test/Transforms/LoopVectorize/pointer-induction.ll
  llvm/test/Transforms/LoopVectorize/pr39417-optsize-scevchecks.ll
  llvm/test/Transforms/LoopVectorize/pr44488-predication.ll
  llvm/test/Transforms/LoopVectorize/pr47343-expander-lcssa-after-cfg-update.ll
  llvm/test/Transforms/LoopVectorize/pr50686.ll
  llvm/test/Transforms/LoopVectorize/pr55167-fold-tail-live-out.ll
  llvm/test/Transforms/LoopVectorize/pr58811-scev-expansion.ll
  llvm/test/Transforms/LoopVectorize/reduction-with-invariant-store.ll
  llvm/test/Transforms/LoopVectorize/runtime-check-needed-but-empty.ll
  llvm/test/Transforms/LoopVectorize/scev-exit-phi-invalidation.ll
  llvm/test/Transforms/LoopVectorize/scev-predicate-reasoning.ll
  llvm/test/Transforms/LoopVectorize/select-reduction-start-value-may-be-undef-or-poison.ll
  llvm/test/Transforms/LoopVectorize/single-value-blend-phis.ll
  llvm/test/Transforms/LoopVectorize/strided-accesses-interleave-only.ll
  llvm/test/Transforms/LoopVectorize/trunc-shifts.ll
  llvm/test/Transforms/LoopVectorize/uniform_across_vf_induction1.ll
  llvm/test/Transforms/LoopVectorize/uniform_across_vf_induction1_and.ll
  llvm/test/Transforms/LoopVectorize/uniform_across_vf_induction1_div_urem.ll
  llvm/test/Transforms/LoopVectorize/uniform_across_vf_induction1_lshr.ll
  llvm/test/Transforms/LoopVectorize/uniform_across_vf_induction2.ll
  llvm/test/Transforms/LoopVectorize/widen-gep-all-indices-invariant.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158332.553913.patch
Type: text/x-patch
Size: 282588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230828/e674290d/attachment-0001.bin>


More information about the llvm-commits mailing list