1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt -S -passes=safe-stack -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s --check-prefix=TLS
4 target datalayout = "A5"
6 define void @correct_alloca_addrspace() nounwind uwtable safestack {
7 ; TLS-LABEL: define void @correct_alloca_addrspace(
8 ; TLS-SAME: ) #[[ATTR0:[0-9]+]] !annotation [[META0:![0-9]+]] {
9 ; TLS-NEXT: [[ENTRY:.*:]]
10 ; TLS-NEXT: [[UNSAFE_STACK_PTR:%.*]] = load ptr addrspace(5), ptr @__safestack_unsafe_stack_ptr, align 8
11 ; TLS-NEXT: [[UNSAFE_STACK_STATIC_TOP:%.*]] = getelementptr i8, ptr addrspace(5) [[UNSAFE_STACK_PTR]], i32 -16
12 ; TLS-NEXT: store ptr addrspace(5) [[UNSAFE_STACK_STATIC_TOP]], ptr @__safestack_unsafe_stack_ptr, align 8
13 ; TLS-NEXT: [[TMP0:%.*]] = getelementptr i8, ptr addrspace(5) [[UNSAFE_STACK_PTR]], i32 -8
14 ; TLS-NEXT: call void @Capture_as5(ptr addrspace(5) [[TMP0]])
15 ; TLS-NEXT: store ptr addrspace(5) [[UNSAFE_STACK_PTR]], ptr @__safestack_unsafe_stack_ptr, align 8
19 %a = alloca i8, align 8, addrspace(5)
20 call void @Capture_as5(ptr addrspace(5) %a)
24 declare void @Capture_as5(ptr addrspace(5))
26 ; TLS: [[META0]] = !{!"unsafe-stack-size", i32 16}