[llvm] [DAG] canCreateUndefOrPoison - remove isGuaranteedNotToBeUndefOrPoison check for shift nodes (PR #146502)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 03:30:58 PDT 2025


https://github.com/RKSimon created https://github.com/llvm/llvm-project/pull/146502

No longer necessary now that #146490 has landed - we still have the test coverage from #94145 that covers this.

>From 07dc3472971621ac9e9bb3507988fd542e364605 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Tue, 1 Jul 2025 11:30:23 +0100
Subject: [PATCH] [DAG] canCreateUndefOrPoison - remove
 isGuaranteedNotToBeUndefOrPoison check for shift nodes

No longer necessary now that #146490 has landed - we still have the test coverage from #94145 that covers this.
---
 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index ad941a1964683..4ec6be534e278 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5616,9 +5616,7 @@ bool SelectionDAG::canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts,
   case ISD::SRA:
     // If the max shift amount isn't in range, then the shift can
     // create poison.
-    return !isGuaranteedNotToBeUndefOrPoison(Op.getOperand(1), DemandedElts,
-                                             PoisonOnly, Depth + 1) ||
-           !getValidMaximumShiftAmount(Op, DemandedElts, Depth + 1);
+    return !getValidMaximumShiftAmount(Op, DemandedElts, Depth + 1);
 
   case ISD::SCALAR_TO_VECTOR:
     // Check if we demand any upper (undef) elements.



More information about the llvm-commits mailing list