[llvm] [SelectionDAG] Preserve poison for abs INT_MIN lowering (PR #183851)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 15:49:21 PDT 2026


================
@@ -4314,8 +4316,9 @@ SDValue DAGCombiner::visitSUB(SDNode *N) {
     }
 
     // Convert 0 - abs(x).
-    if (N1.getOpcode() == ISD::ABS && N1.hasOneUse() &&
-        !TLI.isOperationLegalOrCustom(ISD::ABS, VT))
+    if ((N1.getOpcode() == ISD::ABS || N1.getOpcode() == ISD::ABS_MIN_POISON) &&
----------------
RKSimon wrote:

SDPatternMatch::m_AnyABS() maybe?

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


More information about the llvm-commits mailing list