[CodeGen] Fix FoldConstantVectorArithmetic for scalable vectors
authorDavid Sherwood <david.sherwood@arm.com>
Wed, 6 May 2020 07:03:15 +0000 (08:03 +0100)
committerDavid Sherwood <david.sherwood@arm.com>
Fri, 15 May 2020 13:58:44 +0000 (14:58 +0100)
commitfb1c55b57dda134866803bdf3cdda2cc57a7dc5c
treed19e8754cb6b003fc1ca22fdc44f702703df45d8
parent8c24f33158d81d5f4b0c5d27c2f07396f0f1484b
[CodeGen] Fix FoldConstantVectorArithmetic for scalable vectors

For now I have changed FoldConstantVectorArithmetic to return early
if we encounter a scalable vector, since the subsequent code assumes
you can perform lane-wise constant folds. However, in future work we
should be able to extend this to look at splats of a constant value
and fold those if possible. I have also added the same code to
FoldConstantArithmetic, since that deals with vectors too.

The warnings I fixed in this patch were being generated by this
existing test:

  CodeGen/AArch64/sve-int-arith.ll

Differential Revision: https://reviews.llvm.org/D79421
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp