summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2012-03-19 15:35:44 +0000
committerDuncan Sands <baldrick@free.fr>2012-03-19 15:35:44 +0000
commit00294caadb5cdb4cafeb5e1c05486a395fef590c (patch)
treeb9e12b031be4f6978cf92ed790023c0f8201366b /lib
parent3e99b715d1f9fd3db9ee3847d845e2804bd82280 (diff)
downloadllvm-00294caadb5cdb4cafeb5e1c05486a395fef590c.tar.gz
llvm-00294caadb5cdb4cafeb5e1c05486a395fef590c.tar.bz2
llvm-00294caadb5cdb4cafeb5e1c05486a395fef590c.tar.xz
Fix DAG combine which creates illegal vector shuffles. Patch by Heikki Kultala.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153035 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 32b9fa4ec3..1bd1b95ad7 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -7473,6 +7473,12 @@ SDValue DAGCombiner::visitBUILD_VECTOR(SDNode *N) {
// Check to see if this is a BUILD_VECTOR of a bunch of EXTRACT_VECTOR_ELT
// operations. If so, and if the EXTRACT_VECTOR_ELT vector inputs come from
// at most two distinct vectors, turn this into a shuffle node.
+
+ // May only combine to shuffle after legalize if shuffle is legal.
+ if (LegalOperations &&
+ !TLI.isOperationLegalOrCustom(ISD::VECTOR_SHUFFLE, VT))
+ return SDValue();
+
SDValue VecIn1, VecIn2;
for (unsigned i = 0; i != NumInScalars; ++i) {
// Ignore undef inputs.