[SDAG] Fix pow2 assumption when splitting vectors
authorCarl Ritson <carl.ritson@amd.com>
Thu, 10 Jun 2021 23:40:21 +0000 (08:40 +0900)
committerCarl Ritson <carl.ritson@amd.com>
Thu, 10 Jun 2021 23:58:16 +0000 (08:58 +0900)
commitcfbb92441f17d1f5a9d9c3e195646df4117cb0ca
tree438a53284cc45399c745994a09a1a2686ca07ce6
parentb35a842581f089daa57dd7e6b78ccb08d92709b2
[SDAG] Fix pow2 assumption when splitting vectors

When reducing vector builds to shuffles it possible that
the DAG combiner may try to extract invalid subvectors.

This happens as the existing code assumes vectors will be power
of 2 sizes, which is already untrue, but becomes more noticable
with v6 and v7 types.
Specifically the existing code assumes that half PowerOf2Ceil of
a given vector index will fit twice into a given vector.

Reviewed By: RKSimon

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