1 ; Test that unsafe alloca address calculation is done immediately before each use.
2 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
3 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4 ; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
5 ; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
7 define void @f() safestack {
9 %x0 = alloca i32, align 4
10 %x1 = alloca i32, align 4
12 ; CHECK: %[[A:.*]] = getelementptr i8, ptr %{{.*}}, i32 -4
13 ; CHECK: call void @use(ptr %[[A]])
14 call void @use(ptr %x0)
16 ; CHECK: %[[B:.*]] = getelementptr i8, ptr %{{.*}}, i32 -8
17 ; CHECK: call void @use(ptr %[[B]])
18 call void @use(ptr %x1)
22 declare void @use(ptr)