[llvm] [SelectionDAG] Propagate poison in getNode with two operands if the second is poison. (PR #135387)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 15 12:37:03 PDT 2025


================
@@ -7601,16 +7601,20 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
     case ISD::SDIV:
     case ISD::UREM:
     case ISD::SREM:
-      return getUNDEF(VT);       // fold op(arg1, undef) -> undef
+      // fold op(arg1, undef) -> undef, // fold op(arg1, poison) -> poison.
----------------
topperc wrote:

Please also update the switch in the else block of the `N1.isUndef()` check on line 7573. We should be consistent about poison on both the left and right hand side for the same opcodes.

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


More information about the llvm-commits mailing list