When scalarizing a vector BITCAST, check whether the operand has vector
[oota-llvm.git] / lib / CodeGen / SelectionDAG / LegalizeDAG.cpp
index 1a3370f0a06e7649646e46d6e26690ea60f53135..0c37f5262926636ef5572c3541d3a9b27dc33899 100644 (file)
@@ -7961,7 +7961,8 @@ SDValue SelectionDAGLegalize::ScalarizeVectorOp(SDValue Op) {
     break;
   case ISD::BIT_CONVERT: {
     SDValue Op0 = Op.getOperand(0);
-    if (Op0.getValueType().getVectorNumElements() == 1)
+    if (Op0.getValueType().isVector() &&
+        Op0.getValueType().getVectorNumElements() == 1)
       Op0 = ScalarizeVectorOp(Op0);
     Result = DAG.getNode(ISD::BIT_CONVERT, dl, NewVT, Op0);
     break;