[llvm] [DAG] canCreateUndefOrPoison - explicitly state the AssertSext/Zext/Align/NoFPClass can create poison (PR #146493)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 1 02:09:03 PDT 2025
https://github.com/RKSimon created https://github.com/llvm/llvm-project/pull/146493
This keeps getting forgotten (e.g. #66603) - so make a point of adding it here to make it more clear instead of relying on the implicit default of returning true.
>From b19405579a51666737a5a1eb24cf637ed0c64938 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Tue, 1 Jul 2025 10:08:16 +0100
Subject: [PATCH] [DAG] canCreateUndefOrPoison - explicitly state the
AssertSext/Zext/Align/NoFPClass can create poison
This keeps getting forgotten (e.g. #66603) - so make a point of adding it here to make it more clear instead of relying on the implicit default of returning true.
---
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 7 +++++++
1 file changed, 7 insertions(+)
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