[llvm] [DAG] canCreateUndefOrPoison - remove isGuaranteedNotToBeUndefOrPoison check for insert/extract vector element indices (PR #146514)

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


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

No longer necessary now that #146490 has landed

>From 050e7d623092911a850c161178ff6262d14cee3d Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Tue, 1 Jul 2025 12:44:19 +0100
Subject: [PATCH] [DAG] canCreateUndefOrPoison - remove
 isGuaranteedNotToBeUndefOrPoison check for insert/extract vector element
 indices

No longer necessary now that #146490 has landed
---
 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index a1e4d706ef6b2..569b816756891 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5636,12 +5636,8 @@ bool SelectionDAG::canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts,
     // Ensure that the element index is in bounds.
     EVT VecVT = Op.getOperand(0).getValueType();
     SDValue Idx = Op.getOperand(Opcode == ISD::INSERT_VECTOR_ELT ? 2 : 1);
-    if (isGuaranteedNotToBeUndefOrPoison(Idx, DemandedElts, PoisonOnly,
-                                         Depth + 1)) {
-      KnownBits KnownIdx = computeKnownBits(Idx, Depth + 1);
-      return KnownIdx.getMaxValue().uge(VecVT.getVectorMinNumElements());
-    }
-    return true;
+    KnownBits KnownIdx = computeKnownBits(Idx, Depth + 1);
+    return KnownIdx.getMaxValue().uge(VecVT.getVectorMinNumElements());
   }
 
   case ISD::VECTOR_SHUFFLE: {



More information about the llvm-commits mailing list