1 ; RUN: opt < %s -passes=globalopt -S | FileCheck %s
3 ; When removing the store to @global in @foo, the pass would incorrectly return
4 ; false. This was caught by the pass return status check that is hidden under
7 ; CHECK: @global = internal unnamed_addr global ptr null, align 1
11 ; CHECK-NEXT: ret i16 undef
13 @global = internal unnamed_addr global ptr null, align 1
15 ; Function Attrs: nofree noinline norecurse nounwind writeonly
16 define i16 @foo(i16 %c) local_unnamed_addr #0 {
18 %local1.addr = alloca i16, align 1
19 store ptr %local1.addr, ptr @global, align 1
23 ; Function Attrs: noinline nounwind writeonly
24 define i16 @bar() local_unnamed_addr #1 {
26 %local2 = alloca [1 x i16], align 1
27 call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %local2)
28 store ptr %local2, ptr @global, align 1
29 call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %local2)
33 ; Function Attrs: argmemonly nounwind willreturn
34 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
36 ; Function Attrs: argmemonly nounwind willreturn
37 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
39 attributes #0 = { nofree noinline norecurse nounwind writeonly }
40 attributes #1 = { noinline nounwind writeonly }
41 attributes #2 = { argmemonly nounwind willreturn }