[PATCH] D127595: [DAG] visitINSERT_VECTOR_ELT - attempt to reconstruct BUILD_VECTOR before other fold interfere

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 12 04:57:39 PDT 2022


RKSimon created this revision.
RKSimon added reviewers: craig.topper, dmgreen, spatel, deadalnix, efriedma, paulwalker-arm.
Herald added subscribers: jsji, mstorsjo, StephenFan, frasercrmck, ecnelises, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
Herald added a project: All.
RKSimon requested review of this revision.
Herald added subscribers: pcwang-thead, MaskRay.
Herald added a project: LLVM.

Another issue unearthed by D127115 <https://reviews.llvm.org/D127115>

We take a long time to canonicalize an insert_vector_elt chain before being able to convert it into a build_vector - even if they are already in ascending insertion order, we fold the nodes one at a time in to the build_vector 'seed', leaving plenty of time for other folds to alter it (in particular recognising when they come from extract_vector_elt resulting in a shuffle_vector that is much harder to fold with).

D127115 <https://reviews.llvm.org/D127115> makes this particularly difficult as we're almost guaranteed to have the lost the sequence before all possible insertions have been made.

This patch proposes to begin at the last insertion and attempt to collect all the (oneuse) insertions right away and create the build_vector before its too late.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127595

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/test/CodeGen/AArch64/arm64-neon-copy.ll
  llvm/test/CodeGen/AArch64/sve-fixed-length-insert-vector-elt.ll
  llvm/test/CodeGen/AArch64/vecreduce-propagate-sd-flags.ll
  llvm/test/CodeGen/ARM/neon-copy.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-insert-i1.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-masked-gather.ll
  llvm/test/CodeGen/X86/avx512-insert-extract.ll
  llvm/test/CodeGen/X86/masked_gather_scatter.ll
  llvm/test/CodeGen/X86/sse-insertelt-from-mem.ll
  llvm/test/CodeGen/X86/sse-insertelt.ll
  llvm/test/CodeGen/X86/vec_insert-7.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127595.436208.patch
Type: text/x-patch
Size: 15852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220612/e884ffd8/attachment.bin>


More information about the llvm-commits mailing list