[PATCH] D108961: [RISCV] MC relaxation for out-of-range conditional branch.

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 2 08:27:17 PDT 2021


asb added a comment.

In D108961#2979635 <https://reviews.llvm.org/D108961#2979635>, @jrtc27 wrote:

> FWIW, I *think* the origin of this stems from:
>
> (a) GCC/binutils divide
> (b) GCC uses pseudos in its output (even uses li in some cases, though often mixed in with other shifts and adds for decomposing immediates, bit odd)
> (c) GCC has limited knowledge of compression
>
> so GCC doesn't actually know how far away things are and thus can't pick the right branch all the time. Fixing it up in the assembler was presumably the easier solution rather than fixing GCC to emit correct assembly. That then has the unfortunate effect of becoming something hand-written assembly relies on (e.g. bbl was, as was FreeBSD in one place very early on before LLVM was mature enough to build it).

That's a good point re the origin of this kind of magic. It probably strengthens the argument in my mind for supporting this - being able to take .s generated by GCC and assemble it with clang/LLVM is a good thing (and we should probably be doing more such testing).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108961/new/

https://reviews.llvm.org/D108961



More information about the llvm-commits mailing list