[llvm] [LegalizeVectorOps] Use getBoolConstant instead of getAllOnesConstant in VectorLegalizer::UnrollVSETCC. (PR #121526)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 15:01:28 PST 2025


================
@@ -2250,7 +2250,8 @@ SDValue VectorLegalizer::UnrollVSETCC(SDNode *Node) {
                          TLI.getSetCCResultType(DAG.getDataLayout(),
                                                 *DAG.getContext(), TmpEltVT),
                          LHSElem, RHSElem, CC);
-    Ops[i] = DAG.getSelect(dl, EltVT, Ops[i], DAG.getAllOnesConstant(dl, EltVT),
+    Ops[i] = DAG.getSelect(dl, EltVT, Ops[i],
+                           DAG.getBoolConstant(true, dl, EltVT, VT),
                            DAG.getConstant(0, dl, EltVT));
----------------
RKSimon wrote:

I still think this should be:
```
    Ops[i] = DAG.getNode(ISD::SETCC, dl, MVT::i1, LHSElem, RHSElem, CC);
    Ops[i] = DAG.getBoolExtOrTrunc(Ops[i], dl, EltVT, VT);
```
But the last time I attempted this it resulted in a lot of churn: https://github.com/RKSimon/llvm-project/tree/unroll-setcc

https://github.com/llvm/llvm-project/pull/121526


More information about the llvm-commits mailing list