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

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 13:42:09 PST 2024


================
@@ -11874,6 +11874,47 @@ bool TargetLowering::LegalizeSetCCCondCode(SelectionDAG &DAG, EVT VT,
       return true;
     }
 
+    // Special case: expand i1 comparisons using logical operations.
+    if (OpVT == MVT::i1) {
----------------
AlexMaclean wrote:

> Why does this need the type special case? 

The logical simplifications we're using to expand setcc for i1 will not be correct for larger types.

> LegalizeSetCCCondCode should do as asked regardless of the type

In theory yes, but this isn't the case today, and creating a valid expansion for all types x cond-codes would be a time consuming way to add a lot of in practice dead code. 


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


More information about the llvm-commits mailing list