Add a dagcombine optimization to convert concat_vectors of undefs into a single undef.
The unoptimized concat_vectors isd prevented the canonicalization of the vector_shuffle node.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160221 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index e2c7dec..1e87d51 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -7816,6 +7816,17 @@
   if (N->getNumOperands() == 1)
     return N->getOperand(0);
 
+  // Check if all of the operands are undefs.
+  bool AllUndef = true;
+  for (unsigned i = 0; i < N->getNumOperands(); ++i)
+    if (N->getOperand(i).getOpcode() != ISD::UNDEF) {
+      AllUndef = false;
+      break;
+    }
+
+  if (AllUndef)
+    return DAG.getUNDEF(N->getValueType(0));
+
   return SDValue();
 }