[llvm] [RISCV][MC] Add aliases for beq/bne with x0 as the first argument => beqz/bnez (PR #139086)

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Sun May 11 08:12:12 PDT 2025


asb wrote:

> c.beqz/c.bnez has a smaller displacement range too doesn't it?

Yes, I've clarified this in the PR description.

> Are these case also caused by MachineCopyPropagation and TailDuplication?

The ones I've looked at yes. We could canonicalise such branches in SimplifyInstruction, but I think the main motivation would be for assembly printing (there's a potential secondary motivation for canonicalisation that makes other code easier to write, but I don't think it has an impact as things stand today). As it's such a trivial variant, supporting it directly in the MC layer makes sense to me.



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


More information about the llvm-commits mailing list