[SDAG] Treat DemandedElts argument to isSplatVector as splat for scalable vectors...
authorPhilip Reames <preames@rivosinc.com>
Tue, 11 Oct 2022 16:32:49 +0000 (09:32 -0700)
committerPhilip Reames <listmail@philipreames.com>
Tue, 11 Oct 2022 16:49:28 +0000 (09:49 -0700)
commit487695e7c99e340c59876853c000403c411af777
treefebd99b38a194321e98b7b70dc5f0acad171aaa9
parentb267ac49e764c65322cf772647ff26d6732e5134
[SDAG] Treat DemandedElts argument to isSplatVector as splat for scalable vectors [nfc]

The previous code used a APInt(1, 0) to represent the demanded elts of a scalable vector, and then ignored that argument if type was scalable.  This was inconsistent with the UndefElts parameter which is set to either APInt(1, 0) or APInt(1,1) - that is, implicitly broadcast across all lanes.  Particularly since the undef code relied on the DemandedElts parameter having bitwidth 1 to achieve that result!

This change switches the demanded parameter to APInt(1,1), documents the broadcast semantics, and takes advantage of it to remove one special case for scalable vectors which is no longer required.
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/unittests/CodeGen/AArch64SelectionDAGTest.cpp