[llvm] [AArch64] Improve lowering of scalar abs(sub(a, b)). (PR #151180)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 8 10:36:36 PDT 2025


AZero13 wrote:

I would like to revisit this.

Mostly because honestly, I don't think that selection lowering should deal with only this specific case.

So I'm wondering: I want to do one of two things:

either make the transform (subs (sub (x, y) 0) -> subs (x, y) if one use and not using overflow or carry flags, in general, not just for this case:

Or have peephole catch these cases.

I tried implementing the first one in global-isel and it had mixed results: many regressions but some improvements.

There's also the fact that peephole should be catching this anyway but isn't. 

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


More information about the llvm-commits mailing list