[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 May 15 04:20:44 PDT 2025


================
@@ -12074,6 +12078,17 @@ 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:

#140042

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


More information about the llvm-commits mailing list