[llvm] [RISCV][MC] Add aliases for beq/bne with x0 as the first argument => beqz/bnez (PR #139086)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon May 12 10:00:35 PDT 2025
topperc 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.
Canonicalizing in SimplifyInstruction would ensure that llvm-objudmp and GNU objdump both print the same output without needing to change GNU objdump.
https://github.com/llvm/llvm-project/pull/139086
More information about the llvm-commits
mailing list