[llvm] [NVPTX] Fix lowering of i1 SETCC (PR #115035)

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 15:27:22 PST 2024


================
@@ -18738,8 +18738,9 @@ SDValue DAGCombiner::rebuildSetCC(SDValue N) {
       if (LegalTypes)
         SetCCVT = getSetCCResultType(SetCCVT);
       // Replace the uses of XOR with SETCC
-      return DAG.getSetCC(SDLoc(N), SetCCVT, Op0, Op1,
-                          Equal ? ISD::SETEQ : ISD::SETNE);
+      const ISD::CondCode CC = Equal ? ISD::SETEQ : ISD::SETNE;
+      if (!LegalOperations || TLI.isCondCodeLegal(CC, Op0.getSimpleValueType()))
+        return DAG.getSetCC(SDLoc(N), SetCCVT, Op0, Op1, CC);
----------------
AlexMaclean wrote:

I'm disabling this particular transform from running after operation legalization on targets where the SETCC which would be created is not legal. I'm allowing the fold to happen prior to operation legalization in case this folding could trigger other transformations which might be beneficial. 

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


More information about the llvm-commits mailing list