[all-commits] [llvm/llvm-project] 7d8fd4: [DAG] visitINSERT_VECTOR_ELT - attempt to reconstr...

Simon Pilgrim via All-commits all-commits at lists.llvm.org
Mon Jun 13 03:49:13 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7d8fd4f5db0dd52cf9802889690aab876ad6646b
      https://github.com/llvm/llvm-project/commit/7d8fd4f5db0dd52cf9802889690aab876ad6646b
  Author: Simon Pilgrim <llvm-dev at redking.me.uk>
  Date:   2022-06-13 (Mon, 13 Jun 2022)

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

  Log Message:
  -----------
  [DAG] visitINSERT_VECTOR_ELT - attempt to reconstruct BUILD_VECTOR before other fold interfere

Another issue unearthed by 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 into 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 makes this particularly difficult as we're almost guaranteed to have the lost the sequence before all possible insertions have been folded.

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.

Differential Revision: https://reviews.llvm.org/D127595




More information about the All-commits mailing list