summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-02-22 07:05:27 +0000
committerCraig Topper <craig.topper@intel.com>2018-02-22 07:05:27 +0000
commit1d104b996a70fe82ded7dfbc77e21b042c30943a (patch)
tree4b6b5d23437dca53d6ce1a97bb9568bfa86e735a /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent966642d5bb45363030940b5dbb8083537648ae26 (diff)
downloadbcm5719-llvm-1d104b996a70fe82ded7dfbc77e21b042c30943a.tar.gz
bcm5719-llvm-1d104b996a70fe82ded7dfbc77e21b042c30943a.zip
[DAGCombiner] Add two calls to isVector before making calls to getVectorElementType/getVectorNumElements to avoid an assert.
We looked through a BITCAST, but the bitcast might be a from a scalar type rather than a vector. I don't have a test case. I stumbled onto it while prototyping another change that isn't ready yet. llvm-svn: 325750
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 902e9ca4913..158a020d443 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -16417,10 +16417,11 @@ SDValue DAGCombiner::visitINSERT_SUBVECTOR(SDNode *N) {
if (N0.getOpcode() == ISD::BITCAST && N1.getOpcode() == ISD::BITCAST) {
SDValue CN0 = N0.getOperand(0);
SDValue CN1 = N1.getOperand(0);
- if (CN0.getValueType().getVectorElementType() ==
- CN1.getValueType().getVectorElementType() &&
- CN0.getValueType().getVectorNumElements() ==
- VT.getVectorNumElements()) {
+ EVT CN0VT = CN0.getValueType();
+ EVT CN1VT = CN1.getValueType();
+ if (CN0VT.isVector() && CN1VT.isVector() &&
+ CN0VT.getVectorElementType() == CN1VT.getVectorElementType() &&
+ CN0VT.getVectorNumElements() == VT.getVectorNumElements()) {
SDValue NewINSERT = DAG.getNode(ISD::INSERT_SUBVECTOR, SDLoc(N),
CN0.getValueType(), CN0, CN1, N2);
return DAG.getBitcast(VT, NewINSERT);
OpenPOWER on IntegriCloud