1; RUN: llc -march=hexagon < %s | FileCheck %s
2; Check that the load/store to the volatile stack object has not been
3; optimized away.
4
5target triple = "hexagon"
6
7; CHECK-LABEL: foo
8; CHECK: memw(r29+#4) =
9; CHECK: = memw(r29+#4)
10define i32 @foo(i32 %a) #0 {
11entry:
12  %x = alloca i32, align 4
13  %x.0.x.0..sroa_cast = bitcast i32* %x to i8*
14  call void @llvm.lifetime.start.p0i8(i64 4, i8* %x.0.x.0..sroa_cast)
15  store volatile i32 0, i32* %x, align 4
16  %call = tail call i32 bitcast (i32 (...)* @bar to i32 ()*)() #0
17  %x.0.x.0. = load volatile i32, i32* %x, align 4
18  %add = add nsw i32 %x.0.x.0., %a
19  call void @llvm.lifetime.end.p0i8(i64 4, i8* %x.0.x.0..sroa_cast)
20  ret i32 %add
21}
22
23declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
24declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
25
26declare i32 @bar(...) #0
27
28attributes #0 = { nounwind }
29attributes #1 = { argmemonly nounwind }
30