1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

[X86] [Win64] Avoid truncating large (> 32 bit) stack allocations

This fixes PR44129, which was broken in a7adc3185b (in 7.0.0
and newer).

Differential Revision: https://reviews.llvm.org/D70741
This commit is contained in:
Martin Storsjö 2019-11-26 22:41:40 +02:00
parent 259a6db274
commit 0523b5daa7
2 changed files with 15 additions and 1 deletions

View File

@ -1261,7 +1261,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF,
if (Is64Bit) {
// Handle the 64-bit Windows ABI case where we need to call __chkstk.
// Function prologue is responsible for adjusting the stack pointer.
int Alloc = isEAXAlive ? NumBytes - 8 : NumBytes;
int64_t Alloc = isEAXAlive ? NumBytes - 8 : NumBytes;
if (isUInt<32>(Alloc)) {
BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32ri), X86::EAX)
.addImm(Alloc)

View File

@ -0,0 +1,14 @@
; RUN: llc < %s -mtriple=x86_64-windows-gnu | FileCheck %s
define void @foo() unnamed_addr #0 {
start:
%b = alloca i64, align 8
%c = alloca [4294967295 x i8], align 1
ret void
}
attributes #0 = { nonlazybind uwtable "probe-stack"="probe_stack" "target-cpu"="x86-64" }
; CHECK-LABEL: foo:
; CHECK: movabsq $4294967304, %rax
; CHECK-NEXT: callq probe_stack