1; RUN: opt -globalopt -S < %s | FileCheck %s 2 3@a = internal global i32 0, align 4 4@b = internal global i32 0, align 4 5@c = internal global i32 0, align 4 6@d = internal constant [4 x i8] c"foo\00", align 1 7@e = linkonce_odr global i32 0 8 9; CHECK: @a = internal global i32 0, align 4 10; CHECK: @b = internal global i32 0, align 4 11; CHECK: @c = internal unnamed_addr global i32 0, align 4 12; CHECK: @d = internal unnamed_addr constant [4 x i8] c"foo\00", align 1 13; CHECK: @e = linkonce_odr local_unnamed_addr global i32 0 14 15; CHECK: define internal fastcc void @used_internal() unnamed_addr { 16define internal void @used_internal() { 17 ret void 18} 19 20define i32 @get_e() { 21 call void @used_internal() 22 %t = load i32, i32* @e 23 ret i32 %t 24} 25 26define void @set_e(i32 %x) { 27 store i32 %x, i32* @e 28 ret void 29} 30 31define i1 @bah(i64 %i) nounwind readonly optsize ssp { 32entry: 33 %arrayidx4 = getelementptr inbounds [4 x i8], [4 x i8]* @d, i64 0, i64 %i 34 %tmp5 = load i8, i8* %arrayidx4, align 1 35 %array0 = bitcast [4 x i8]* @d to i8* 36 %tmp6 = load i8, i8* %array0, align 1 37 %cmp = icmp eq i8 %tmp5, %tmp6 38 ret i1 %cmp 39} 40 41define void @baz(i32 %x) { 42entry: 43 store i32 %x, i32* @a, align 4 44 store i32 %x, i32* @b, align 4 45 store i32 %x, i32* @c, align 4 46 ret void 47} 48 49define i32 @foo(i32* %x) nounwind readnone optsize ssp { 50entry: 51 %cmp = icmp eq i32* %x, @a 52 %conv = zext i1 %cmp to i32 53 ret i32 %conv 54} 55 56define i32 @bar() { 57entry: 58 switch i64 ptrtoint (i32* @b to i64), label %sw.epilog [ 59 i64 1, label %return 60 i64 0, label %return 61 ] 62 63sw.epilog: 64 ret i32 0 65 66return: 67 ret i32 1 68} 69 70define i32 @zed() { 71entry: 72 %tmp1 = load i32, i32* @c, align 4 73 ret i32 %tmp1 74} 75