[PATCH] D80999: [ARM][CodeGen] Enabling spilling of high registers in RegAllocFast for Thumb1

Lucas Prates via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 08:43:04 PDT 2020


pratlucas added a comment.

After taking a deeper look at ARMConstantIslandPass, I believe this patch won't actually cause any issues when interacting with it.

Please correct me if I'm wrong, but from what I've checked the pass's dependency on LR not being live is simply to allow it to replace unconditional branches that are out of range with BL instructions, which overrides the contents of LR.
Also, the pass doesn't seem to handle the contents of inline asm, keeping the user's assembly code as it is.

As LR is a high register, the only impact this patch has on it is allowing RegAllocFast to spill it when necessary - i.e. when its was intentionally clobbered by the user.
Clobbering it is the only way I see for LR to become live again and it was already a possibility before.

Note that LR is the last on the allocation order for high registers. Due to that, the only scenario I've found where we see a difference in behavior for the clobbering of LR would be when LR is required to handle the inline asm's inputs.
For example:

  void constraint_h(int a, b, c, d, e, f) {
    asm volatile("mov lr, %5"
      :
      : "h" (a), "h" (b), "h" (c), "h" (d), "h" (e), "h" (f)
      : "lr");
  }

Here, RegAllocFast previously hit the assertion failure and after the patch hits the following error:

  error: inline assembly requires more registers than available

Other attempts to clobber LR are handled with no issues both before and after this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80999





More information about the llvm-commits mailing list