[llvm] [InstCombine] Fold usub_sat((sub nuw C1, A), C2) to usub_sat(C1 - C2, A) or 0 (PR #82280)

via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 9 02:08:25 PST 2024


XChy wrote:

> Do we need the vector test?
We always add vector tests if the pattern could handle vectors.

> For this test I think the optimizer converts sub to add and then add a negative number, Is there is a way to match additions with over flow like this:

I think `APInt::uadd_ov` may help. Or if the commuted pattern is difficult now, I think it's OK solve the pattern in original issue first, and then propose another patch for the commuted one, since they are independent.

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


More information about the llvm-commits mailing list