[PATCH] D69018: [AArch64] Fix offset calculation

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 08:18:16 PDT 2019


sdesmalen added a comment.

Thanks for fixing this @smeenai!

In D69018#1710443 <https://reviews.llvm.org/D69018#1710443>, @smeenai wrote:

> I have no idea how to write a test for this; I'm completely unfamiliar with backends. I have a Swift compilation command that reproduces the OOM mentioned in the commit message, and I think I should be able to get IR or MIR from that, but I'd appreciate guidance crafting a test case if it's considered necessary for this commit.


You can create a MIR test with a single instruction accessing a pre-allocated stackslot with a very large offset, and check that the offset is generated correctly.

e.g. the following MIR

  ---
  name: D69018
  tracksRegLiveness: true
  fixedStack:
    - { id: 0, offset: 2147483648, size: 1}
  body: |
    bb.0:
      $x0 = LDRXui %fixed-stack.0, 0
      RET_ReallyLR
  ...

compiles with your patch, but fails to complete (i.e. it keeps running) without it.



================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:3442
   if (EmittableOffset)
     *EmittableOffset = NewOffset;
   if (OutUseUnscaledOp)
----------------
smeenai wrote:
> EmittableOffset is still an int ... idk if I should be promoting that too.
That should be fine, because it will be used for the immediate field of an instruction.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69018





More information about the llvm-commits mailing list