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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 12:03:19 PST 2026


================
@@ -11916,7 +11919,8 @@ SDValue DAGCombiner::visitABS(SDNode *N) {
   if (SDValue C = DAG.FoldConstantArithmetic(ISD::ABS, DL, VT, {N0}))
     return C;
   // fold (abs (abs x)) -> (abs x)
-  if (N0.getOpcode() == ISD::ABS)
+  // fold (abs (abs_min_poison x)) -> (abs x)
----------------
nikic wrote:

```suggestion
  // fold (abs (abs_min_poison x)) -> (abs_min_poison x)
```

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


More information about the llvm-commits mailing list