[llvm] [SelectionDAG] Preserver poison for abs INT_MIN lowering (PR #183851)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 00:17:42 PST 2026
================
@@ -11942,6 +11946,28 @@ SDValue DAGCombiner::visitABS(SDNode *N) {
return SDValue();
}
+SDValue DAGCombiner::visitABS_MIN_POISON(SDNode *N) {
+ SDValue N0 = N->getOperand(0);
+ EVT VT = N->getValueType(0);
+ SDLoc DL(N);
+
+ // fold (abs_min_poison c1) -> c2
+ if (SDValue C = DAG.FoldConstantArithmetic(ISD::ABS, DL, VT, {N0}))
+ return C;
----------------
arsenm wrote:
This won't fold the poison case to poison
https://github.com/llvm/llvm-project/pull/183851
More information about the llvm-commits
mailing list