xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/global-merge-1.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc %s -O0 -o - | FileCheck -check-prefix=NO-MERGE %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc %s -O0 -o - -arm-global-merge=false | FileCheck -check-prefix=NO-MERGE %s
3*9880d681SAndroid Build Coastguard Worker; RUN: llc %s -O0 -o - -arm-global-merge=true | FileCheck -check-prefix=MERGE %s
4*9880d681SAndroid Build Coastguard Worker; RUN: llc %s -O1 -o - | FileCheck -check-prefix=NO-MERGE %s
5*9880d681SAndroid Build Coastguard Worker; RUN: llc %s -O1 -o - -arm-global-merge=false | FileCheck -check-prefix=NO-MERGE %s
6*9880d681SAndroid Build Coastguard Worker; RUN: llc %s -O1 -o - -arm-global-merge=true | FileCheck -check-prefix=MERGE %s
7*9880d681SAndroid Build Coastguard Worker; RUN: llc %s -O3 -o - | FileCheck -check-prefix=MERGE %s
8*9880d681SAndroid Build Coastguard Worker; RUN: llc %s -O3 -o - -arm-global-merge=false | FileCheck -check-prefix=NO-MERGE %s
9*9880d681SAndroid Build Coastguard Worker; RUN: llc %s -O3 -o - -arm-global-merge=true | FileCheck -check-prefix=MERGE %s
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; MERGE-NOT: .zerofill __DATA,__bss,_bar,20,2
12*9880d681SAndroid Build Coastguard Worker; MERGE-NOT: .zerofill __DATA,__bss,_baz,20,2
13*9880d681SAndroid Build Coastguard Worker; MERGE-NOT: .zerofill __DATA,__bss,_foo,20,2
14*9880d681SAndroid Build Coastguard Worker; MERGE: .zerofill __DATA,__bss,l__MergedGlobals,60,4
15*9880d681SAndroid Build Coastguard Worker; MERGE-NOT: .zerofill __DATA,__bss,_bar,20,2
16*9880d681SAndroid Build Coastguard Worker; MERGE-NOT: .zerofill __DATA,__bss,_baz,20,2
17*9880d681SAndroid Build Coastguard Worker; MERGE-NOT: .zerofill __DATA,__bss,_foo,20,2
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker; NO-MERGE-NOT: .zerofill __DATA,__bss,l__MergedGlobals,60,4
20*9880d681SAndroid Build Coastguard Worker; NO-MERGE: .zerofill __DATA,__bss,_bar,20,2
21*9880d681SAndroid Build Coastguard Worker; NO-MERGE: .zerofill __DATA,__bss,_baz,20,2
22*9880d681SAndroid Build Coastguard Worker; NO-MERGE: .zerofill __DATA,__bss,_foo,20,2
23*9880d681SAndroid Build Coastguard Worker; NO-MERGE-NOT: .zerofill __DATA,__bss,l__MergedGlobals,60,4
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
26*9880d681SAndroid Build Coastguard Workertarget triple = "thumbv7-apple-ios3.0.0"
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker@bar = internal global [5 x i32] zeroinitializer, align 4
29*9880d681SAndroid Build Coastguard Worker@baz = internal global [5 x i32] zeroinitializer, align 4
30*9880d681SAndroid Build Coastguard Worker@foo = internal global [5 x i32] zeroinitializer, align 4
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind ssp
33*9880d681SAndroid Build Coastguard Workerdefine internal void @initialize() #0 {
34*9880d681SAndroid Build Coastguard Worker  %1 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
35*9880d681SAndroid Build Coastguard Worker  store i32 %1, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 0), align 4, !tbaa !1
36*9880d681SAndroid Build Coastguard Worker  %2 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
37*9880d681SAndroid Build Coastguard Worker  store i32 %2, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 0), align 4, !tbaa !1
38*9880d681SAndroid Build Coastguard Worker  %3 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
39*9880d681SAndroid Build Coastguard Worker  store i32 %3, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 1), align 4, !tbaa !1
40*9880d681SAndroid Build Coastguard Worker  %4 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
41*9880d681SAndroid Build Coastguard Worker  store i32 %4, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 1), align 4, !tbaa !1
42*9880d681SAndroid Build Coastguard Worker  %5 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
43*9880d681SAndroid Build Coastguard Worker  store i32 %5, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 2), align 4, !tbaa !1
44*9880d681SAndroid Build Coastguard Worker  %6 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
45*9880d681SAndroid Build Coastguard Worker  store i32 %6, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 2), align 4, !tbaa !1
46*9880d681SAndroid Build Coastguard Worker  %7 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
47*9880d681SAndroid Build Coastguard Worker  store i32 %7, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 3), align 4, !tbaa !1
48*9880d681SAndroid Build Coastguard Worker  %8 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
49*9880d681SAndroid Build Coastguard Worker  store i32 %8, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 3), align 4, !tbaa !1
50*9880d681SAndroid Build Coastguard Worker  %9 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
51*9880d681SAndroid Build Coastguard Worker  store i32 %9, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 4), align 4, !tbaa !1
52*9880d681SAndroid Build Coastguard Worker  %10 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
53*9880d681SAndroid Build Coastguard Worker  store i32 %10, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 4), align 4, !tbaa !1
54*9880d681SAndroid Build Coastguard Worker  ret void
55*9880d681SAndroid Build Coastguard Worker}
56*9880d681SAndroid Build Coastguard Worker
57*9880d681SAndroid Build Coastguard Workerdeclare i32 @calc(...) #1
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind ssp
60*9880d681SAndroid Build Coastguard Workerdefine internal void @calculate() #0 {
61*9880d681SAndroid Build Coastguard Worker  %1 = load <4 x i32>, <4 x i32>* bitcast ([5 x i32]* @bar to <4 x i32>*), align 4
62*9880d681SAndroid Build Coastguard Worker  %2 = load <4 x i32>, <4 x i32>* bitcast ([5 x i32]* @baz to <4 x i32>*), align 4
63*9880d681SAndroid Build Coastguard Worker  %3 = mul <4 x i32> %2, %1
64*9880d681SAndroid Build Coastguard Worker  store <4 x i32> %3, <4 x i32>* bitcast ([5 x i32]* @foo to <4 x i32>*), align 4
65*9880d681SAndroid Build Coastguard Worker  %4 = load i32, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 4), align 4, !tbaa !1
66*9880d681SAndroid Build Coastguard Worker  %5 = load i32, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 4), align 4, !tbaa !1
67*9880d681SAndroid Build Coastguard Worker  %6 = mul nsw i32 %5, %4
68*9880d681SAndroid Build Coastguard Worker  store i32 %6, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @foo, i32 0, i32 4), align 4, !tbaa !1
69*9880d681SAndroid Build Coastguard Worker  ret void
70*9880d681SAndroid Build Coastguard Worker}
71*9880d681SAndroid Build Coastguard Worker
72*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone ssp
73*9880d681SAndroid Build Coastguard Workerdefine internal i32* @returnFoo() #2 {
74*9880d681SAndroid Build Coastguard Worker  ret i32* getelementptr inbounds ([5 x i32], [5 x i32]* @foo, i32 0, i32 0)
75*9880d681SAndroid Build Coastguard Worker}
76*9880d681SAndroid Build Coastguard Worker
77*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind ssp "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
78*9880d681SAndroid Build Coastguard Workerattributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
79*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind readnone ssp "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
80*9880d681SAndroid Build Coastguard Workerattributes #3 = { nounwind }
81*9880d681SAndroid Build Coastguard Worker
82*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!0}
83*9880d681SAndroid Build Coastguard Worker
84*9880d681SAndroid Build Coastguard Worker!0 = !{!"LLVM version 3.4 "}
85*9880d681SAndroid Build Coastguard Worker!1 = !{!2, !2, i64 0}
86*9880d681SAndroid Build Coastguard Worker!2 = !{!"int", !3, i64 0}
87*9880d681SAndroid Build Coastguard Worker!3 = !{!"omnipotent char", !4, i64 0}
88*9880d681SAndroid Build Coastguard Worker!4 = !{!"Simple C/C++ TBAA"}
89