[llvm] a97826a - [DAG] canCreateUndefOrPoison - explicitly state the AssertSext/Zext/Align/NoFPClass can create poison. NFC. (#146493)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 03:31:50 PDT 2025


Author: Simon Pilgrim
Date: 2025-07-01T11:31:47+01:00
New Revision: a97826a13b7cc5a56e7e87066d3f976ae6aef938

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

LOG: [DAG] canCreateUndefOrPoison - explicitly state the AssertSext/Zext/Align/NoFPClass can create poison. NFC. (#146493)

This keeps getting forgotten (e.g. #66603) - so make a point of adding
it here to make it clear instead of relying on the implicit default of
returning true.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index ad941a1964683..a1e4d706ef6b2 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5522,6 +5522,13 @@ bool SelectionDAG::canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts,
 
   unsigned Opcode = Op.getOpcode();
   switch (Opcode) {
+  case ISD::AssertSext:
+  case ISD::AssertZext:
+  case ISD::AssertAlign:
+  case ISD::AssertNoFPClass:
+    // Assertion nodes can create poison if the assertion fails.
+    return true;
+
   case ISD::FREEZE:
   case ISD::CONCAT_VECTORS:
   case ISD::INSERT_SUBVECTOR:


        


More information about the llvm-commits mailing list