[llvm] [InstCombine] Pattern match minmax calls for unsigned saturation. (PR #99250)

Huihui Zhang via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 16:36:27 PDT 2024


huihzhang wrote:

Thanks @goldsteinn!
Caught a bug while doing alive2 testing. Update fix in [commit#3](https://github.com/llvm/llvm-project/pull/99250/commits/603655d2ed39e4622756924ae4d449210bc553fd) .

When trying to fold "umin(UINT_MAX, BinOp(zext(A), zext(B)))" into uadd_sat, we need to make sure BinOp is known non-negative.

Please also see alive2 verification below:
uadd_sat: https://alive2.llvm.org/ce/z/v-LJZr
usub_sat: https://alive2.llvm.org/ce/z/h34acm


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


More information about the llvm-commits mailing list