[PATCH] D130560: [RISCV] Handle register spill in branch relaxation

Celeste Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 01:11:00 PDT 2022


CoelacanthusHex added a comment.

In D130560#3686584 <https://reviews.llvm.org/D130560#3686584>, @piggynl wrote:

> In D130560#3684918 <https://reviews.llvm.org/D130560#3684918>, @CoelacanthusHex wrote:
>
>> There seems to be a problem here: if we perform only some operations on registers without sd after a jump (which can easily happen if only a few short instructions are executed between jumps), we then jump to another place. If we still restore immediately in this case, we are actually wasting resources.
>
> Yes. We can construct a loop with a few instructions executed and a long jump at each iteration, making the jump scratch register saved/restored frequently. Maybe we can add a TODO in BranchRelaxation.cpp for future improvements?

Yes, I think we should add TODO.
I have some ideas, but the expected effect is not good.  If I can improve the algorithm and implement it, I will open a PR.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130560



More information about the llvm-commits mailing list