[X86] Emit fewer instructions to allocate >16GB stack frames

Description

[X86] Emit fewer instructions to allocate >16GB stack frames

Summary:
Use this code pattern when RAX is live, instead of emitting up to 2
billion adjustments:

pushq %rax
movabsq +-$Offset+-8, %rax
addq %rsp, %rax
xchg %rax, (%rsp)
movq (%rsp), %rsp

Try to clean this code up a bit while I'm here. In particular, hoist the
logic that handles the entire adjustment with movabsq $imm, %rax out
of the loop.

This negates the offset in the prologue and uses ADD because X86 only
has a two operand subtract which always subtracts from the destination
register, which can no longer be RSP.

Fixes PR31962

Reviewers: majnemer, sdardis

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30052

Details

Committed
rnkMar 17 2017, 1:25 PM
Differential Revision
D30052: [X86] Emit fewer instructions to allocate >16GB stack frames
Parents
rL298115: [PGO] Add omitted test cases.
Branches
Unknown
Tags
Unknown