1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/Transforms/SafeStack/X86/layout-frag.ll
Eric Christopher a62270de2c Revert "Temporarily Revert "Add basic loop fusion pass.""
The reversion apparently deleted the test/Transforms directory.

Will be re-reverting again.

llvm-svn: 358552
2019-04-17 04:52:47 +00:00

40 lines
1.3 KiB
LLVM

; Test that safestack layout reuses a region w/o fragmentation.
; RUN: opt -safe-stack -safe-stack-coloring=1 -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
define void @f() safestack {
; CHECK-LABEL: define void @f
entry:
; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
; CHECK: getelementptr i8, i8* %[[USP]], i32 -16
%x0 = alloca i64, align 8
%x1 = alloca i8, align 1
%x2 = alloca i64, align 8
%x0a = bitcast i64* %x0 to i8*
%x2a = bitcast i64* %x2 to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %x0a)
call void @capture64(i64* %x0)
call void @llvm.lifetime.end.p0i8(i64 4, i8* %x0a)
call void @llvm.lifetime.start.p0i8(i64 4, i8* %x1)
call void @llvm.lifetime.start.p0i8(i64 4, i8* %x2a)
call void @capture8(i8* %x1)
call void @capture64(i64* %x2)
call void @llvm.lifetime.end.p0i8(i64 4, i8* %x1)
call void @llvm.lifetime.end.p0i8(i64 4, i8* %x2a)
; Test that i64 allocas share space.
; CHECK: getelementptr i8, i8* %unsafe_stack_ptr, i32 -8
; CHECK: getelementptr i8, i8* %unsafe_stack_ptr, i32 -9
; CHECK: getelementptr i8, i8* %unsafe_stack_ptr, i32 -8
ret void
}
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
declare void @capture8(i8*)
declare void @capture64(i64*)