[llvm] [SelectionDAG] Handle more opcodes in isGuaranteedNotToBeUndefOrPoison (PR #147019)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 29 03:14:49 PDT 2025


================
@@ -5480,6 +5557,52 @@ bool SelectionDAG::isGuaranteedNotToBeUndefOrPoison(SDValue Op,
     return true;
   }
 
+  case ISD::SHL:
+  case ISD::SRL:
+  case ISD::SRA:
+    // Shift amount operand is checked by canCreateUndefOrPoison. So it is
+    // enough to check operand 0 if Op can't create undef/poison.
+    return !canCreateUndefOrPoison(Op, DemandedElts, PoisonOnly,
+                                   /*ConsiderFlags*/ true, Depth) &&
+           isGuaranteedNotToBeUndefOrPoison(Op.getOperand(0), DemandedElts,
+                                            PoisonOnly, Depth + 1);
+
+  case ISD::BSWAP:
----------------
RKSimon wrote:

Which of these have you explicitly checked and which are just by inspection?

https://github.com/llvm/llvm-project/pull/147019


More information about the llvm-commits mailing list