// TODO - handle more cases as required.
if (V.getOpcode() == ISD::BUILD_VECTOR)
return V.getOperand(Idx).isUndef();
+ if (V.getOpcode() == ISD::SCALAR_TO_VECTOR)
+ return (Idx != 0) || V.getOperand(0).isUndef();
return false;
};
if (!N0->hasOneUse() || !N1->hasOneUse())
return SDValue();
+
// If only one of N1,N2 is constant, bail out if it is not ALL_ZEROS as
// discussed above.
if (!N1.isUndef()) {
if (S.getOpcode() == ISD::BUILD_VECTOR) {
Op = S.getOperand(Idx);
} else if (S.getOpcode() == ISD::SCALAR_TO_VECTOR) {
- if (Idx == 0)
- Op = S.getOperand(0);
+ assert(Idx == 0 && "Unexpected SCALAR_TO_VECTOR operand index.");
+ Op = S.getOperand(0);
} else {
// Operand can't be combined - bail out.
return SDValue();
Ops.push_back(Op);
}
+
// BUILD_VECTOR requires all inputs to be of the same type, find the
// maximum type and extend them all.
EVT SVT = VT.getScalarType();