[llvm] [AArch64] Enable preferZeroCompareBranch for AArch64 when we don't have fused cmp+br (PR #150045)

David Green via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 27 05:06:42 PDT 2025


davemgreen wrote:

> Same number of instructions at best
> Unless cbz takes 2 cycles to do instead of 1, I don't see how

Do you mean at worst?

They will both be branch predicted, so I should probably have said that they resolve a cycles later. If the cmp_br is fused it can start a cycle before, if it doesn't need to wait for the result of the add/sub/xor/lsr.

Can you add a test for the add / sub / xor variants too? My tests were inconclusive but as this can reduce code size it sounds OK to me.

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


More information about the llvm-commits mailing list