summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Stuttard <david.stuttard@amd.com>2017-10-10 12:45:45 +0000
committerDavid Stuttard <david.stuttard@amd.com>2017-10-10 12:45:45 +0000
commit51c1b2280665589c82329b9d6dfb20600ba42efa (patch)
treec5054a0ecca62f7cfe07b44b7bea7a318b6c34f1 /llvm/lib/CodeGen
parent9ba7401a7bf0a823402e71dcf8503d18a7647b00 (diff)
downloadbcm5719-llvm-51c1b2280665589c82329b9d6dfb20600ba42efa.tar.gz
bcm5719-llvm-51c1b2280665589c82329b9d6dfb20600ba42efa.zip
[DAGCombine] Fix for shuffle to vector extend for non power 2 vectors
Summary: See https://llvm.org/PR33743 for more details It seems that for non-power of 2 vector sizes, the algorithm can produce non-matching sizes for input and result causing an assert. This usually isn't a problem as the isAnyExtend check will weed these out, but in some cases (most often with lots of undefined values for the mask indices) it can pass this check for non power of 2 vectors. Adding in an extra check that ensures that bit size will match for the result and input (as required) Subscribers: nhaehnle Differential Revision: https://reviews.llvm.org/D35241 llvm-svn: 315307
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 526c3b8d878..fef1c8f749c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -15566,6 +15566,9 @@ static SDValue combineShuffleToVectorExtend(ShuffleVectorSDNode *SVN,
// Attempt to match a '*_extend_vector_inreg' shuffle, we just search for
// power-of-2 extensions as they are the most likely.
for (unsigned Scale = 2; Scale < NumElts; Scale *= 2) {
+ // Check for non power of 2 vector sizes
+ if (NumElts % Scale != 0)
+ continue;
if (!isAnyExtend(Scale))
continue;
OpenPOWER on IntegriCloud