[PATCH] D18619: [AArch64] Combine callee-save and local stack SP adjustment instructions.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 13:56:41 PDT 2016


Hi Geoff,

Sorry it took so long to get back to you, I needed to do some serious
thinking about this one. Mostly it's OK, but I think this is
problematic:

> unsigned EstNonCSStackSize = MFI->estimateStackSize(MF);
> unsigned StackSize = EstNonCSStackSize + 8 * NumRegsSpilled;
> if (EstNonCSStackSize != 0 &&
>      // 512 is the maximum immediate for stp/ldp that will be used for
>     // callee-save save/restores
>      StackSize < 512 &&

Using an estimate here leaves us open for a change later on, which is
catastrophic if it pushes the amount over the 512-byte limit. It's
rare that the estimate differs from the actual amount by more than 8
(the correctness threshold since the STP offset is actually where you
want the first register to go) but it can happen.

I've attached an example where I've tweaked this discrepancy into a
real failure.

Tim.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple.ll
Type: application/octet-stream
Size: 1769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160502/84cf6ab7/attachment.obj>


More information about the llvm-commits mailing list