[llvm] [AArch64] Enable preferZeroCompareBranch for AArch64 (PR #145803)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 5 11:04:48 PDT 2025


AZero13 wrote:

> I'm not super sure either way, especially about the "has no drawbacks". Do you have any benchmark results?
> 
> Many cores can fuse cmp+branch together, and it looks like this will transform
> 
> ```
>   //  %c = icmp ult %x, 8
>   //  br %c, bla, blb
>   //  %tc = lshr %x, 3
>   // to
>   //  %tc = lshr %x, 3
>   //  %c = icmp eq %tc, 0
>   //  br %c, bla, blb
> ```
> 
> We don't have lshr that sets flags like we do for Arm, but do have a cbz. The branch might happen later, but the codesize is likely smaller.

We have tbnz if that counts. 

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


More information about the llvm-commits mailing list