[SVE] Fix incorrect DAG combines when extracting fixed-width from scalable vectors
authorDavid Sherwood <david.sherwood@arm.com>
Tue, 28 Sep 2021 13:33:10 +0000 (14:33 +0100)
committerDavid Sherwood <david.sherwood@arm.com>
Wed, 6 Oct 2021 08:27:44 +0000 (09:27 +0100)
commit37edb7d3e26353ffd8a239b3f850925dc913a6bb
tree1f637042085fae5d8315815e12f3019328a652b4
parent0c7495848a02e1bcc68527c77c2a060ffae408c1
[SVE] Fix incorrect DAG combines when extracting fixed-width from scalable vectors

We were previously silently generating incorrect code when extracting a
fixed-width vector from a scalable vector. This is worse than crashing,
since the user will have no indication that this is currently unsupported
behaviour. I have fixed the code to only perform DAG combines when safe
to do so, i.e. the input and output vectors are both fixed-width or
both scalable.

Test added here:

  CodeGen/AArch64/sve-extract-scalable-vector.ll

Differential revision: https://reviews.llvm.org/D110624
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/sve-extract-fixed-from-scalable-vector.ll [new file with mode: 0644]