From 32063888700f57bf57ede4f24efb727fd3f284c5 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Fri, 2 Mar 2018 20:38:41 +0000 Subject: [SystemZ] Fix common-code users of stack size On SystemZ we need to provide a register save area of 160 bytes to any called function. This size needs to be added when allocating stack in the function prologue. However, it was not accounted for as part of MachineFrameInfo::getStackSize(); instead the back-end used a private routine getAllocatedStackSize(). This is OK for code-gen purposes, but it breaks other users of the getStackSize() routine, in particular it breaks the recently- added -stack-size-section feature. Fix this by updating the main stack size tracked by common code (in emitPrologue) instead of using the private routine. No change in code generation intended. llvm-svn: 326610 --- llvm/test/CodeGen/SystemZ/stack-size-section.ll | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 llvm/test/CodeGen/SystemZ/stack-size-section.ll (limited to 'llvm/test/CodeGen/SystemZ') diff --git a/llvm/test/CodeGen/SystemZ/stack-size-section.ll b/llvm/test/CodeGen/SystemZ/stack-size-section.ll new file mode 100644 index 00000000000..52dffc80308 --- /dev/null +++ b/llvm/test/CodeGen/SystemZ/stack-size-section.ll @@ -0,0 +1,38 @@ +; RUN: llc < %s -mtriple=s390x-linux-gnu -stack-size-section | FileCheck %s + +; CHECK-LABEL: func1: +; CHECK: .section .stack_sizes,"",@progbits +; CHECK-NEXT: .quad func1 +; CHECK-NEXT: .byte 0 +define void @func1(i32, i32) #0 { + ret void +} + +; CHECK-LABEL: func2: +; CHECK: .section .stack_sizes,"",@progbits +; CHECK-NEXT: .quad func2 +; CHECK-NEXT: .ascii "\250\001" +define void @func2(i32, i32) #0 { + alloca i32, align 4 + alloca i32, align 4 + ret void +} + +; CHECK-LABEL: func3: +; CHECK: .section .stack_sizes,"",@progbits +; CHECK-NEXT: .quad func3 +; CHECK-NEXT: .ascii "\250\001" +define void @func3() #0 { + alloca i32, align 4 + call void @func1(i32 1, i32 2) + ret void +} + +; CHECK-LABEL: dynalloc: +; CHECK-NOT: .section .stack_sizes +define void @dynalloc(i32 %N) #0 { + alloca i32, i32 %N + ret void +} + +attributes #0 = { "no-frame-pointer-elim"="true" } -- cgit v1.2.3