[llvm] f72c8dc - [RISCV] canCreateUndefOrPoisonForTargetNode - RISCVISD::SELECT_CC is only for integer comparisons - which can't create poison (#151943)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 08:31:10 PDT 2025


Author: Simon Pilgrim
Date: 2025-08-04T16:31:06+01:00
New Revision: f72c8dce1586d27e4723259166a21f01499dda60

URL: https://github.com/llvm/llvm-project/commit/f72c8dce1586d27e4723259166a21f01499dda60
DIFF: https://github.com/llvm/llvm-project/commit/f72c8dce1586d27e4723259166a21f01499dda60.diff

LOG: [RISCV] canCreateUndefOrPoisonForTargetNode - RISCVISD::SELECT_CC is only for integer comparisons - which can't create poison (#151943)

The result type is irrelevant - its the comparison type that matters

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index b6d1ee8bc3050..9e1deea93b971 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -21478,11 +21478,10 @@ bool RISCVTargetLowering::canCreateUndefOrPoisonForTargetNode(
   // TODO: Add more target nodes.
   switch (Op.getOpcode()) {
   case RISCVISD::SELECT_CC:
-    // Integer select_cc cannot create poison.
-    // TODO: What are the FP poison semantics?
-    // TODO: This instruction blocks poison from the unselected operand, can
-    // we do anything with that?
-    return !Op.getValueType().isInteger();
+    // Integer comparisons cannot create poison.
+    assert(Op.getOperand(0).getValueType().isInteger() &&
+           "RISCVISD::SELECT_CC only compares integers");
+    return false;
   }
   return TargetLowering::canCreateUndefOrPoisonForTargetNode(
       Op, DemandedElts, DAG, PoisonOnly, ConsiderFlags, Depth);


        


More information about the llvm-commits mailing list