[llvm] 94fbb14 - [STACKMAPS] Document+test UINT64_MAX stack size.
Edd Barrett via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 27 03:58:30 PDT 2022
Author: Edd Barrett
Date: 2022-06-27T11:57:07+01:00
New Revision: 94fbb147c8cee70124c8cce3c8e61dd952f41004
URL: https://github.com/llvm/llvm-project/commit/94fbb147c8cee70124c8cce3c8e61dd952f41004
DIFF: https://github.com/llvm/llvm-project/commit/94fbb147c8cee70124c8cce3c8e61dd952f41004.diff
LOG: [STACKMAPS] Document+test UINT64_MAX stack size.
When a function does a dynamic stack allocation, the function's stack
size (in the stack map) is reported as UINT64_MAX.
This change tests and documents this property.
Differential Revision: https://reviews.llvm.org/D128525
Added:
llvm/test/CodeGen/AArch64/stackmap-dynamic-alloca.ll
llvm/test/CodeGen/SystemZ/stackmap-dynamic-alloca.ll
llvm/test/CodeGen/X86/stackmap-dynamic-alloca.ll
Modified:
llvm/docs/StackMaps.rst
Removed:
################################################################################
diff --git a/llvm/docs/StackMaps.rst b/llvm/docs/StackMaps.rst
index 8f7f41a2fb47f..783336e2d8065 100644
--- a/llvm/docs/StackMaps.rst
+++ b/llvm/docs/StackMaps.rst
@@ -328,7 +328,7 @@ format of this section follows:
uint32 : NumRecords
StkSizeRecord[NumFunctions] {
uint64 : Function Address
- uint64 : Stack Size
+ uint64 : Stack Size (or UINT64_MAX if not statically known)
uint64 : Record Count
}
Constants[NumConstants] {
diff --git a/llvm/test/CodeGen/AArch64/stackmap-dynamic-alloca.ll b/llvm/test/CodeGen/AArch64/stackmap-dynamic-alloca.ll
new file mode 100644
index 0000000000000..46e3375405ab4
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/stackmap-dynamic-alloca.ll
@@ -0,0 +1,30 @@
+; RUN: llc < %s -mtriple=arm64-linux-gnu | FileCheck %s
+
+; When a function does a dynamic stack allocation, the function's stack size
+; is reported as UINT64_MAX.
+
+; CHECK-LABEL: .section .llvm_stackmaps
+; CHECK-NEXT: __LLVM_StackMaps:
+; Header
+; CHECK-NEXT: .byte 3
+; CHECK-NEXT: .byte 0
+; CHECK-NEXT: .hword 0
+; Num Functions
+; CHECK-NEXT: .word 1
+; Num LargeConstants
+; CHECK-NEXT: .word 0
+; Num Callsites
+; CHECK-NEXT: .word 1
+
+; Functions and stack size
+; CHECK-NEXT: .xword f
+; CHECK-NEXT: .xword -1
+
+define void @f(i32 %nelems) {
+entry:
+ %mem = alloca i32, i32 %nelems
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 0, i32 0, i32* %mem)
+ ret void
+}
+
+declare void @llvm.experimental.stackmap(i64, i32, ...)
diff --git a/llvm/test/CodeGen/SystemZ/stackmap-dynamic-alloca.ll b/llvm/test/CodeGen/SystemZ/stackmap-dynamic-alloca.ll
new file mode 100644
index 0000000000000..6223ccd768073
--- /dev/null
+++ b/llvm/test/CodeGen/SystemZ/stackmap-dynamic-alloca.ll
@@ -0,0 +1,30 @@
+; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
+
+; When a function does a dynamic stack allocation, the function's stack size
+; is reported as UINT64_MAX.
+
+; CHECK: .section .llvm_stackmaps
+; CHECK-NEXT: __LLVM_StackMaps:
+; Header
+; CHECK-NEXT: .byte 3
+; CHECK-NEXT: .byte 0
+; CHECK-NEXT: .short 0
+; Num Functions
+; CHECK-NEXT: .long 1
+; Num LargeConstants
+; CHECK-NEXT: .long 0
+; Num Callsites
+; CHECK-NEXT: .long 1
+
+; Functions and stack size
+; CHECK-NEXT: .quad f
+; CHECK-NEXT: .quad -1
+
+define void @f(i32 %nelems) {
+entry:
+ %mem = alloca i32, i32 %nelems
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 0, i32 0, i32* %mem)
+ ret void
+}
+
+declare void @llvm.experimental.stackmap(i64, i32, ...)
diff --git a/llvm/test/CodeGen/X86/stackmap-dynamic-alloca.ll b/llvm/test/CodeGen/X86/stackmap-dynamic-alloca.ll
new file mode 100644
index 0000000000000..784116cda4a96
--- /dev/null
+++ b/llvm/test/CodeGen/X86/stackmap-dynamic-alloca.ll
@@ -0,0 +1,30 @@
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck %s
+
+; When a function does a dynamic stack allocation, the function's stack size is
+; reported as UINT64_MAX.
+
+; CHECK-LABEL: .section __LLVM_STACKMAPS,__llvm_stackmaps
+; CHECK-NEXT: __LLVM_StackMaps:
+; Header
+; CHECK-NEXT: .byte 3
+; CHECK-NEXT: .byte 0
+; CHECK-NEXT: .short 0
+; Num Functions
+; CHECK-NEXT: .long 1
+; Num LargeConstants
+; CHECK-NEXT: .long 0
+; Num Callsites
+; CHECK-NEXT: .long 1
+
+; Functions and stack size
+; CHECK-NEXT: .quad _f
+; CHECK-NEXT: .quad -1
+
+define void @f(i32 %nelems) {
+entry:
+ %mem = alloca i32, i32 %nelems
+ call void (i64, i32, ...) @llvm.experimental.stackmap(i64 0, i32 0, i32* %mem)
+ ret void
+}
+
+declare void @llvm.experimental.stackmap(i64, i32, ...)
More information about the llvm-commits
mailing list