[PATCH] D152659: [LV] Add IRBuilder folder to simplify GEP x, 0.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 11 15:20:44 PDT 2023


fhahn created this revision.
fhahn added reviewers: Ayal, gilr, rengolin, reames.
Herald added subscribers: luke, StephenFan, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, dmgreen, Jim, jocewei, PkmX, arphaman, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added subscribers: pcwang-thead, MaskRay.
Herald added a project: LLVM.

Add LVFolder to simplify  GEP x, 0 -> x. Further simplifications will
follow in later patches. The goal of the folder is to remove some
obviously redundant instructions, to generate more compact IR, which in
turn should make the tests easier to read.

At the moment, new folders would need to implement the whole interface.
To avoid that, update ConstantFolder to allow sub-classes.

Note that using the more powerful InstSimplifyFolder does not work,
because it requires the input IR to be in a valid state.

There are a few remaining tests to update.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152659

Files:
  llvm/include/llvm/IR/ConstantFolder.h
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/AArch64/eliminate-tail-predication.ll
  llvm/test/Transforms/LoopVectorize/AArch64/epilog-vectorization-widen-inductions.ll
  llvm/test/Transforms/LoopVectorize/AArch64/extractvalue-no-scalarization-required.ll
  llvm/test/Transforms/LoopVectorize/AArch64/first-order-recurrence-fold-tail.ll
  llvm/test/Transforms/LoopVectorize/AArch64/fixed-order-recurrence.ll
  llvm/test/Transforms/LoopVectorize/AArch64/gather-do-not-vectorize-addressing.ll
  llvm/test/Transforms/LoopVectorize/AArch64/interleave-allocsize-not-equal-typesize.ll
  llvm/test/Transforms/LoopVectorize/AArch64/interleaving-load-store.ll
  llvm/test/Transforms/LoopVectorize/AArch64/interleaving-reduction.ll
  llvm/test/Transforms/LoopVectorize/AArch64/scalable-avoid-scalarization.ll
  llvm/test/Transforms/LoopVectorize/AArch64/scalable-reduction-inloop-cond.ll
  llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
  llvm/test/Transforms/LoopVectorize/AArch64/streaming-compatible-sve-no-maximize-bandwidth.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect-inloop-reductions.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect-reductions.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect-strict-reductions.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-epilog-vect.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-fneg.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-inductions-unusual-types.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-inv-store.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-live-out-pointer-induction.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-multiexit.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-runtime-check-size-based-threshold.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-forced.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-optsize.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-reductions.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-unroll.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding.ll
  llvm/test/Transforms/LoopVectorize/AArch64/sve-widen-gep.ll
  llvm/test/Transforms/LoopVectorize/AArch64/synthesize-mask-for-call.ll
  llvm/test/Transforms/LoopVectorize/AArch64/tail-fold-uniform-memops.ll
  llvm/test/Transforms/LoopVectorize/AArch64/tail-folding-styles.ll
  llvm/test/Transforms/LoopVectorize/AArch64/widen-call-with-intrinsic-or-libfunc.ll
  llvm/test/Transforms/LoopVectorize/ARM/mve-gather-scatter-tailpred.ll
  llvm/test/Transforms/LoopVectorize/ARM/mve-multiexit.ll
  llvm/test/Transforms/LoopVectorize/ARM/mve-reduction-types.ll
  llvm/test/Transforms/LoopVectorize/ARM/sphinx.ll
  llvm/test/Transforms/LoopVectorize/ARM/tail-folding-not-allowed.ll
  llvm/test/Transforms/LoopVectorize/ARM/tail-folding-scalar-epilogue-fallback.ll
  llvm/test/Transforms/LoopVectorize/RISCV/defaults.ll
  llvm/test/Transforms/LoopVectorize/RISCV/inloop-reduction.ll
  llvm/test/Transforms/LoopVectorize/RISCV/lmul.ll
  llvm/test/Transforms/LoopVectorize/RISCV/low-trip-count.ll
  llvm/test/Transforms/LoopVectorize/RISCV/mask-index-type.ll
  llvm/test/Transforms/LoopVectorize/RISCV/ordered-reduction.ll
  llvm/test/Transforms/LoopVectorize/RISCV/riscv-unroll.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/illegal-parallel-loop-uniform-write.ll
  llvm/test/Transforms/LoopVectorize/X86/imprecise-through-phis.ll
  llvm/test/Transforms/LoopVectorize/X86/interleave-opaque-pointers.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/pr34438.ll
  llvm/test/Transforms/LoopVectorize/X86/pr35432.ll
  llvm/test/Transforms/LoopVectorize/X86/pr36524.ll
  llvm/test/Transforms/LoopVectorize/X86/pr47437.ll
  llvm/test/Transforms/LoopVectorize/X86/pr51366-sunk-instruction-used-outside-of-loop.ll
  llvm/test/Transforms/LoopVectorize/X86/pr56319-vector-exit-cond-optimization-epilogue-vectorization.ll
  llvm/test/Transforms/LoopVectorize/X86/strided_load_cost.ll
  llvm/test/Transforms/LoopVectorize/X86/x86-predication.ll
  llvm/test/Transforms/LoopVectorize/dont-fold-tail-for-const-TC.ll
  llvm/test/Transforms/LoopVectorize/dont-fold-tail-for-divisible-TC.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/fpsat.ll
  llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll
  llvm/test/Transforms/LoopVectorize/if-pred-stores.ll
  llvm/test/Transforms/LoopVectorize/induction-step.ll
  llvm/test/Transforms/LoopVectorize/induction.ll
  llvm/test/Transforms/LoopVectorize/induction_plus.ll
  llvm/test/Transforms/LoopVectorize/instruction-only-used-outside-of-loop.ll
  llvm/test/Transforms/LoopVectorize/is_fpclass.ll
  llvm/test/Transforms/LoopVectorize/load-deref-pred-align.ll
  llvm/test/Transforms/LoopVectorize/load-of-struct-deref-pred.ll
  llvm/test/Transforms/LoopVectorize/loop-form.ll
  llvm/test/Transforms/LoopVectorize/multiple-strides-vectorization.ll
  llvm/test/Transforms/LoopVectorize/no_outside_user.ll
  llvm/test/Transforms/LoopVectorize/opaque-ptr.ll
  llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization-liveout.ll
  llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization.ll
  llvm/test/Transforms/LoopVectorize/pointer-induction.ll
  llvm/test/Transforms/LoopVectorize/pr30654-phiscev-sext-trunc.ll
  llvm/test/Transforms/LoopVectorize/pr35773.ll
  llvm/test/Transforms/LoopVectorize/pr37248.ll
  llvm/test/Transforms/LoopVectorize/pr39417-optsize-scevchecks.ll
  llvm/test/Transforms/LoopVectorize/pr45259.ll
  llvm/test/Transforms/LoopVectorize/pr50686.ll
  llvm/test/Transforms/LoopVectorize/reduction-odd-interleave-counts.ll
  llvm/test/Transforms/LoopVectorize/reduction-with-invariant-store.ll
  llvm/test/Transforms/LoopVectorize/runtime-check-needed-but-empty.ll
  llvm/test/Transforms/LoopVectorize/runtime-check-small-clamped-bounds.ll
  llvm/test/Transforms/LoopVectorize/scalar_after_vectorization.ll
  llvm/test/Transforms/LoopVectorize/scev-predicate-reasoning.ll
  llvm/test/Transforms/LoopVectorize/single-value-blend-phis.ll
  llvm/test/Transforms/LoopVectorize/skeleton-lcssa-crash.ll
  llvm/test/Transforms/LoopVectorize/uniform-blend.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/use-scalar-epilogue-if-tp-fails.ll
  llvm/test/Transforms/LoopVectorize/vector-intrinsic-call-cost.ll



More information about the llvm-commits mailing list