blob: d4d9b0f9d1f3e90f333f7fab9d8b3044b9c28da3 [file] [log] [blame]
Jiangning Liub2ae37f2014-06-11 06:44:53 +00001; RUN: llc %s -O0 -o - | FileCheck -check-prefix=NO-MERGE %s
Ahmed Bougachab96444e2015-04-11 00:06:36 +00002; RUN: llc %s -O0 -o - -arm-global-merge=false | FileCheck -check-prefix=NO-MERGE %s
3; RUN: llc %s -O0 -o - -arm-global-merge=true | FileCheck -check-prefix=MERGE %s
Ahmed Bougachad1655cb2015-03-23 21:17:36 +00004; RUN: llc %s -O1 -o - | FileCheck -check-prefix=NO-MERGE %s
Ahmed Bougachab96444e2015-04-11 00:06:36 +00005; RUN: llc %s -O1 -o - -arm-global-merge=false | FileCheck -check-prefix=NO-MERGE %s
6; RUN: llc %s -O1 -o - -arm-global-merge=true | FileCheck -check-prefix=MERGE %s
Ahmed Bougachad1655cb2015-03-23 21:17:36 +00007; RUN: llc %s -O3 -o - | FileCheck -check-prefix=MERGE %s
Ahmed Bougachab96444e2015-04-11 00:06:36 +00008; RUN: llc %s -O3 -o - -arm-global-merge=false | FileCheck -check-prefix=NO-MERGE %s
9; RUN: llc %s -O3 -o - -arm-global-merge=true | FileCheck -check-prefix=MERGE %s
Jiangning Liub2ae37f2014-06-11 06:44:53 +000010
11; MERGE-NOT: .zerofill __DATA,__bss,_bar,20,2
12; MERGE-NOT: .zerofill __DATA,__bss,_baz,20,2
13; MERGE-NOT: .zerofill __DATA,__bss,_foo,20,2
Adrian Prantl554fd992016-11-11 17:50:09 +000014; MERGE: .zerofill __DATA,__bss,__MergedGlobals,60,4
Jiangning Liub2ae37f2014-06-11 06:44:53 +000015; MERGE-NOT: .zerofill __DATA,__bss,_bar,20,2
16; MERGE-NOT: .zerofill __DATA,__bss,_baz,20,2
17; MERGE-NOT: .zerofill __DATA,__bss,_foo,20,2
18
Adrian Prantl554fd992016-11-11 17:50:09 +000019; NO-MERGE-NOT: .zerofill __DATA,__bss,__MergedGlobals,60,4
Jiangning Liub2ae37f2014-06-11 06:44:53 +000020; NO-MERGE: .zerofill __DATA,__bss,_bar,20,2
21; NO-MERGE: .zerofill __DATA,__bss,_baz,20,2
22; NO-MERGE: .zerofill __DATA,__bss,_foo,20,2
Adrian Prantl554fd992016-11-11 17:50:09 +000023; NO-MERGE-NOT: .zerofill __DATA,__bss,__MergedGlobals,60,4
Jiangning Liub2ae37f2014-06-11 06:44:53 +000024
25target 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"
26target triple = "thumbv7-apple-ios3.0.0"
27
28@bar = internal global [5 x i32] zeroinitializer, align 4
29@baz = internal global [5 x i32] zeroinitializer, align 4
30@foo = internal global [5 x i32] zeroinitializer, align 4
31
32; Function Attrs: nounwind ssp
33define internal void @initialize() #0 {
34 %1 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
David Blaikief72d05b2015-03-13 18:20:45 +000035 store i32 %1, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 0), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000036 %2 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
David Blaikief72d05b2015-03-13 18:20:45 +000037 store i32 %2, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 0), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000038 %3 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
David Blaikief72d05b2015-03-13 18:20:45 +000039 store i32 %3, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 1), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000040 %4 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
David Blaikief72d05b2015-03-13 18:20:45 +000041 store i32 %4, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 1), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000042 %5 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
David Blaikief72d05b2015-03-13 18:20:45 +000043 store i32 %5, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 2), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000044 %6 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
David Blaikief72d05b2015-03-13 18:20:45 +000045 store i32 %6, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 2), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000046 %7 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
David Blaikief72d05b2015-03-13 18:20:45 +000047 store i32 %7, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 3), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000048 %8 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
David Blaikief72d05b2015-03-13 18:20:45 +000049 store i32 %8, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 3), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000050 %9 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
David Blaikief72d05b2015-03-13 18:20:45 +000051 store i32 %9, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 4), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000052 %10 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3
David Blaikief72d05b2015-03-13 18:20:45 +000053 store i32 %10, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 4), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000054 ret void
55}
56
57declare i32 @calc(...) #1
58
59; Function Attrs: nounwind ssp
60define internal void @calculate() #0 {
David Blaikiea79ac142015-02-27 21:17:42 +000061 %1 = load <4 x i32>, <4 x i32>* bitcast ([5 x i32]* @bar to <4 x i32>*), align 4
62 %2 = load <4 x i32>, <4 x i32>* bitcast ([5 x i32]* @baz to <4 x i32>*), align 4
Jiangning Liub2ae37f2014-06-11 06:44:53 +000063 %3 = mul <4 x i32> %2, %1
64 store <4 x i32> %3, <4 x i32>* bitcast ([5 x i32]* @foo to <4 x i32>*), align 4
David Blaikief72d05b2015-03-13 18:20:45 +000065 %4 = load i32, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 4), align 4, !tbaa !1
66 %5 = load i32, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 4), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000067 %6 = mul nsw i32 %5, %4
David Blaikief72d05b2015-03-13 18:20:45 +000068 store i32 %6, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @foo, i32 0, i32 4), align 4, !tbaa !1
Jiangning Liub2ae37f2014-06-11 06:44:53 +000069 ret void
70}
71
72; Function Attrs: nounwind readnone ssp
73define internal i32* @returnFoo() #2 {
David Blaikief72d05b2015-03-13 18:20:45 +000074 ret i32* getelementptr inbounds ([5 x i32], [5 x i32]* @foo, i32 0, i32 0)
Jiangning Liub2ae37f2014-06-11 06:44:53 +000075}
76
77attributes #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" }
78attributes #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" }
79attributes #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" }
80attributes #3 = { nounwind }
81
82!llvm.ident = !{!0}
83
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000084!0 = !{!"LLVM version 3.4 "}
85!1 = !{!2, !2, i64 0}
86!2 = !{!"int", !3, i64 0}
87!3 = !{!"omnipotent char", !4, i64 0}
88!4 = !{!"Simple C/C++ TBAA"}