Skip to content

Commit e32afde

Browse files
authored
[LegalizeVectorOps] Use getBoolConstant instead of getAllOnesConstant in VectorLegalizer::UnrollVSETCC. (#121526)
This code should follow the target preference for boolean contents of a vector type. We shouldn't assume that true is negative one.
1 parent a106ad0 commit e32afde

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2246,11 +2246,13 @@ SDValue VectorLegalizer::UnrollVSETCC(SDNode *Node) {
22462246
DAG.getVectorIdxConstant(i, dl));
22472247
SDValue RHSElem = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, TmpEltVT, RHS,
22482248
DAG.getVectorIdxConstant(i, dl));
2249+
// FIXME: We should use i1 setcc + boolext here, but it causes regressions.
22492250
Ops[i] = DAG.getNode(ISD::SETCC, dl,
22502251
TLI.getSetCCResultType(DAG.getDataLayout(),
22512252
*DAG.getContext(), TmpEltVT),
22522253
LHSElem, RHSElem, CC);
2253-
Ops[i] = DAG.getSelect(dl, EltVT, Ops[i], DAG.getAllOnesConstant(dl, EltVT),
2254+
Ops[i] = DAG.getSelect(dl, EltVT, Ops[i],
2255+
DAG.getBoolConstant(true, dl, EltVT, VT),
22542256
DAG.getConstant(0, dl, EltVT));
22552257
}
22562258
return DAG.getBuildVector(VT, dl, Ops);

0 commit comments

Comments
 (0)