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

Amy Kwan via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 16 10:31:37 PDT 2025


================
@@ -7573,15 +7573,18 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
     } else {
       switch (Opcode) {
       case ISD::SUB:
-        return getUNDEF(VT);     // fold op(undef, arg2) -> undef
+        // fold op(undef, arg2) -> undef, fold op(poison, arg2) ->poison.
----------------
amy-kwan wrote:

Comment nit.
```suggestion
        // fold op(undef, arg2) -> undef, fold op(poison, arg2) -> poison.
```

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


More information about the llvm-commits mailing list