@@ -22750,7 +22750,7 @@ SDValue DAGCombiner::scalarizeExtractedVectorLoad(SDNode *EVE, EVT InVecVT,
22750
22750
/// Transform a vector binary operation into a scalar binary operation by moving
22751
22751
/// the math/logic after an extract element of a vector.
22752
22752
static SDValue scalarizeExtractedBinOp(SDNode *ExtElt, SelectionDAG &DAG,
22753
- const SDLoc &DL) {
22753
+ const SDLoc &DL, bool LegalTypes ) {
22754
22754
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
22755
22755
SDValue Vec = ExtElt->getOperand(0);
22756
22756
SDValue Index = ExtElt->getOperand(1);
@@ -22761,7 +22761,8 @@ static SDValue scalarizeExtractedBinOp(SDNode *ExtElt, SelectionDAG &DAG,
22761
22761
return SDValue();
22762
22762
22763
22763
EVT ResVT = ExtElt->getValueType(0);
22764
- if (Opc == ISD::SETCC && ResVT != Vec.getValueType().getVectorElementType())
22764
+ if (Opc == ISD::SETCC &&
22765
+ (ResVT != Vec.getValueType().getVectorElementType() || LegalTypes))
22765
22766
return SDValue();
22766
22767
22767
22768
// Targets may want to avoid this to prevent an expensive register transfer.
@@ -23024,7 +23025,7 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
23024
23025
}
23025
23026
}
23026
23027
23027
- if (SDValue BO = scalarizeExtractedBinOp(N, DAG, DL))
23028
+ if (SDValue BO = scalarizeExtractedBinOp(N, DAG, DL, LegalTypes ))
23028
23029
return BO;
23029
23030
23030
23031
if (VecVT.isScalableVector())
0 commit comments