[llvm] [InstCombine] Fold smin(-a, x - a) + a to smin(x, 0) (PR #167109)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 8 01:23:42 PST 2025


https://github.com/dtcxzyw requested changes to this pull request.

I'd expect something like `foldBinOpIntoMinMax` (See `FoldOpIntoSelect`). Then you can generalize this fold into `[s|u][min|max](x, y) +/- z -> [s|u][min|max](x +/- z, y +/- z)`
Please be aware of overflow after folding: https://alive2.llvm.org/ce/z/Nu8N4J


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


More information about the llvm-commits mailing list