1 ; RUN: opt -passes=globalopt -S < %s | FileCheck %s
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 @f = internal addrspace(3) global float undef, align 4
10 ; CHECK: @a = internal global i32 0, align 4
11 ; CHECK: @b = internal global i32 0, align 4
12 ; CHECK: @c = internal unnamed_addr global i32 0, align 4
13 ; CHECK: @d = internal unnamed_addr constant [4 x i8] c"foo\00", align 1
14 ; CHECK: @e = linkonce_odr local_unnamed_addr global i32 0
15 ; CHECK: @f = internal unnamed_addr addrspace(3) global float undef, align 4
17 ; CHECK: define internal fastcc void @used_internal() unnamed_addr {
18 define internal void @used_internal() {
23 call void @used_internal()
28 define void @set_e(i32 %x) {
33 define i1 @bah(i64 %i) nounwind readonly optsize ssp {
35 %arrayidx4 = getelementptr inbounds [4 x i8], ptr @d, i64 0, i64 %i
36 %tmp5 = load i8, ptr %arrayidx4, align 1
37 %tmp6 = load i8, ptr @d, align 1
38 %cmp = icmp eq i8 %tmp5, %tmp6
42 define void @baz(i32 %x) {
44 store i32 %x, ptr @a, align 4
45 store i32 %x, ptr @b, align 4
46 store i32 %x, ptr @c, align 4
50 define i32 @foo(ptr %x) nounwind readnone optsize ssp {
52 %cmp = icmp eq ptr %x, @a
53 %conv = zext i1 %cmp to i32
59 switch i64 ptrtoint (ptr @b to i64), label %sw.epilog [
73 %tmp1 = load i32, ptr @c, align 4
77 define float @use_addrspace_cast_for_load() {
78 %p = addrspacecast ptr addrspace(3) @f to ptr
79 %v = load float, ptr %p
83 define void @use_addrspace_cast_for_store(float %x) {
84 %p = addrspacecast ptr addrspace(3) @f to ptr
85 store float %x, ptr %p