1 ; RUN: opt < %s -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 i16* null, align 1
11 ; CHECK-NEXT: ret i16 undef
13 @global = internal unnamed_addr global i16* 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 i16* %local1.addr, i16** @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 %0 = bitcast [1 x i16]* %local2 to i8*
28 call void @llvm.lifetime.start.p0i8(i64 1, i8* nonnull %0)
29 %arraydecay = getelementptr inbounds [1 x i16], [1 x i16]* %local2, i16 0, i16 0
30 store i16* %arraydecay, i16** @global, align 1
31 call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %0)
35 ; Function Attrs: argmemonly nounwind willreturn
36 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #2
38 ; Function Attrs: argmemonly nounwind willreturn
39 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #2
41 attributes #0 = { nofree noinline norecurse nounwind writeonly }
42 attributes #1 = { noinline nounwind writeonly }
43 attributes #2 = { argmemonly nounwind willreturn }