[DAG] More aggressively (extract_vector_elt (build_vector x, y), c) iff element is...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 18 Jul 2023 15:49:54 +0000 (16:49 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 18 Jul 2023 16:31:34 +0000 (17:31 +0100)
commit3ad4f92f83b7a6a79957c9413dfa3a2667c236a6
treee32910b5a022a12187d1c8791b5eb72e686096dc
parentb8bda5093269dfd9e295e445f4cbbdc85c192753
[DAG] More aggressively (extract_vector_elt (build_vector x, y), c) iff element is zero constant

We currently don't extract vector elements from multi-use build vectors unless TLI.aggressivelyPreferBuildVectorSources accepts them, which seems a little extreme for constant build vectors (especially as under some cases ComputeKnownBits will indirectly extract the data for us).

This is causing a few regressions in some upcoming SimplifyDemandedBits work I'm looking at, all of which just need to know that the element is zero, so I've tweaked the fold to accept zero elements as well, which will typically fold very easily.

Differential Revision: https://reviews.llvm.org/D155582
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/aarch64-neon-vector-insert-uaddlv.ll
llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-ext-loads.ll
llvm/test/CodeGen/Mips/cconv/vector.ll
llvm/test/CodeGen/SPARC/float-constants.ll