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 global i32 0 14 15define i32 @get_e() { 16 %t = load i32* @e 17 ret i32 %t 18} 19 20define void @set_e(i32 %x) { 21 store i32 %x, i32* @e 22 ret void 23} 24 25define i1 @bah(i64 %i) nounwind readonly optsize ssp { 26entry: 27 %arrayidx4 = getelementptr inbounds [4 x i8]* @d, i64 0, i64 %i 28 %tmp5 = load i8* %arrayidx4, align 1 29 %array0 = bitcast [4 x i8]* @d to i8* 30 %tmp6 = load i8* %array0, align 1 31 %cmp = icmp eq i8 %tmp5, %tmp6 32 ret i1 %cmp 33} 34 35define void @baz(i32 %x) { 36entry: 37 store i32 %x, i32* @a, align 4 38 store i32 %x, i32* @b, align 4 39 store i32 %x, i32* @c, align 4 40 ret void 41} 42 43define i32 @foo(i32* %x) nounwind readnone optsize ssp { 44entry: 45 %cmp = icmp eq i32* %x, @a 46 %conv = zext i1 %cmp to i32 47 ret i32 %conv 48} 49 50define i32 @bar() { 51entry: 52 switch i64 ptrtoint (i32* @b to i64), label %sw.epilog [ 53 i64 1, label %return 54 i64 0, label %return 55 ] 56 57sw.epilog: 58 ret i32 0 59 60return: 61 ret i32 1 62} 63 64define i32 @zed() { 65entry: 66 %tmp1 = load i32* @c, align 4 67 ret i32 %tmp1 68} 69