[lld] [llvm] [LoongArch] MC relaxation for out-of-range conditional branch (PR #72095)

Jinyang He via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 03:31:57 PST 2023


MQ-mengqing wrote:

> Assembler relaxing out-of-range conditional branches is probably not a good idea. See https://reviews.llvm.org/D108961 If you can drop the gas code, do it, and it will be better than RISC-V :)

Thanks. After reading those comments in that link, I think I should look at BranchRelaxation.cpp and pay attention to the follows,
1, the NOPs emited by alignment directives when relax enabled.
2, the bytes emited by hand-written assembly, include `.align`, `.rept` and other directives.
3, the timing of BranchRelaxation pass. E.g. it should run after the expandPseudo pass.
If I understand those comments correctly, I should try BranchRelaxation rather than what gas does because llvm has integrated assembler while gcc not.

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


More information about the llvm-commits mailing list