[PATCH] D102342: [SPARC] Fix register reuse in leaf function remapping step

Koakuma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 28 15:30:02 PST 2022


koakuma added a comment.

Ping.

In D102342#3129148 <https://reviews.llvm.org/D102342#3129148>, @LemonBoy wrote:

> The section H.12 of the SPARC Architecture manual outlines the whole register remapping process that requires the re-allocation of `%oN` to free `%gN` registers if needed, I didn't implement the whole thing because of time/interest constraints but as it's written it should be relatively easy to add the missing steps.

I tried to implement this, but as far as I understand it, it's impossible (or at least very hard) to do when it's already this late because even if we manage to put the load result in a %gN register, there's no way to emit an extra mov to get the value into %o5.
Also, as an additional note, functions that does not contain inline assembly generates the correct code on unpatched LLVM, so I believe the existing register remapping is already mostly working as intended.

I propose keeping the remapRegsForLeafProc() as is and add a check to isLeafProc() so that it refuses to optimize a function if it contains inline assembly instead. To me, it seems that it's a less invasive option, what do you think?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102342



More information about the llvm-commits mailing list