[llvm] [InstCombine] Decompose icmp over min/max intrinsics when compared with a constant (PR #182461)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 21 03:28:07 PST 2026
dtcxzyw wrote:
According to the IR diff in llvm-opt-benchmark I don't think this canonicalization enables more optimizations in the middle-end. BTW the decomposed form doesn't win across multiple targets: https://godbolt.org/z/sz1v3GTze
As for the motivating case, it makes more sense to convert `smin((sub nsw A, C), (sub nsw B, C))` into `sub nsw smin(A, B), C` in the middle-end. We already have similar transformations for add/shl in `foldIntrinsicUsingDistributiveLaws`.
https://github.com/llvm/llvm-project/pull/182461
More information about the llvm-commits
mailing list