[llvm] [DAGCombiner] Fold subtraction if above a constant threshold to `umin` (PR #135194)

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 09:51:58 PDT 2025


================
@@ -12074,6 +12078,12 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) {
 
     if (SDValue NewSel = SimplifySelect(DL, N0, N1, N2))
       return NewSel;
+
+    // (select (ugt x, C), (add x, ~C), x) -> (umin (add x, ~C), x)
----------------
pfusik wrote:

Added. It stems from corresponding C code.

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


More information about the llvm-commits mailing list