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
5define void @f() safestack {
6entry:
7  %x0 = alloca i32, align 4
8  %x1 = alloca i32, align 4
9
10; CHECK: %[[A:.*]] = getelementptr i8, i8* %{{.*}}, i32 -4
11; CHECK: %[[X0:.*]] = bitcast i8* %[[A]] to i32*
12; CHECK: call void @use(i32* %[[X0]])
13  call void @use(i32* %x0)
14
15; CHECK: %[[B:.*]] = getelementptr i8, i8* %{{.*}}, i32 -8
16; CHECK: %[[X1:.*]] = bitcast i8* %[[B]] to i32*
17; CHECK: call void @use(i32* %[[X1]])
18  call void @use(i32* %x1)
19  ret void
20}
21
22declare void @use(i32*)
23