brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 8a5362b Raw
39 lines · plain
1; Test that safestack layout reuses a region w/o fragmentation.2; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s3; RUN: opt -passes=safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s4 5define void @f() safestack {6; CHECK-LABEL: define void @f7entry:8; CHECK:  %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr9; CHECK:   getelementptr i8, ptr %[[USP]], i32 -1610 11  %x0 = alloca i64, align 812  %x1 = alloca i8, align 113  %x2 = alloca i64, align 814 15 16  call void @llvm.lifetime.start.p0(ptr %x0)17  call void @capture64(ptr %x0)18  call void @llvm.lifetime.end.p0(ptr %x0)19 20  call void @llvm.lifetime.start.p0(ptr %x1)21  call void @llvm.lifetime.start.p0(ptr %x2)22  call void @capture8(ptr %x1)23  call void @capture64(ptr %x2)24  call void @llvm.lifetime.end.p0(ptr %x1)25  call void @llvm.lifetime.end.p0(ptr %x2)26 27; Test that i64 allocas share space.28; CHECK: getelementptr i8, ptr %unsafe_stack_ptr, i32 -829; CHECK: getelementptr i8, ptr %unsafe_stack_ptr, i32 -930; CHECK: getelementptr i8, ptr %unsafe_stack_ptr, i32 -831 32  ret void33}34 35declare void @llvm.lifetime.start.p0(ptr nocapture)36declare void @llvm.lifetime.end.p0(ptr nocapture)37declare void @capture8(ptr)38declare void @capture64(ptr)39