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

Sacha Coppey via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 07:44:32 PDT 2022


Zeavee added a comment.

In D108961#3648244 <https://reviews.llvm.org/D108961#3648244>, @StephenFan wrote:

> llc has branchrelaxation, doesn't it solve your problem?

I did not know branchrelaxation where applied this way, so I went to read the code, but sadly, it does not seem to be enough in this case.
As it is possible to apply relaxations after fixups, would it be possible that the newly added instructions by the relaxation add more distance in the branch, leading to a too long jump? Since the branchrelaxation seems to work correctly from the debug output, this is my current best guess. For testing purpose, I tried enforcing branchrelaxation on cases where the value was already small enough, and it fixed the error, which would indeed mean that the base branchrelaxation are not enough.
If I'm not mistaken, the solution would be to apply relaxation for branches as well if other relaxations are applied, but I'm still new to LLVM, so I do not know everything about it yet.


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