| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 1 | ; RUN: llc %s -O0 -o - | FileCheck -check-prefix=NO-MERGE %s |
| 2 | ; RUN: llc %s -O0 -o - -enable-global-merge=false | FileCheck -check-prefix=NO-MERGE %s |
| 3 | ; RUN: llc %s -O0 -o - -enable-global-merge=true | FileCheck -check-prefix=NO-MERGE %s |
| 4 | ; RUN: llc %s -O1 -o - | FileCheck -check-prefix=MERGE %s |
| 5 | ; RUN: llc %s -O1 -o - -enable-global-merge=false | FileCheck -check-prefix=NO-MERGE %s |
| 6 | ; RUN: llc %s -O1 -o - -enable-global-merge=true | FileCheck -check-prefix=MERGE %s |
| 7 | |
| 8 | ; MERGE-NOT: .zerofill __DATA,__bss,_bar,20,2 |
| 9 | ; MERGE-NOT: .zerofill __DATA,__bss,_baz,20,2 |
| 10 | ; MERGE-NOT: .zerofill __DATA,__bss,_foo,20,2 |
| 11 | ; MERGE: .zerofill __DATA,__bss,__MergedGlobals,60,4 |
| 12 | ; MERGE-NOT: .zerofill __DATA,__bss,_bar,20,2 |
| 13 | ; MERGE-NOT: .zerofill __DATA,__bss,_baz,20,2 |
| 14 | ; MERGE-NOT: .zerofill __DATA,__bss,_foo,20,2 |
| 15 | |
| 16 | ; NO-MERGE-NOT: .zerofill __DATA,__bss,__MergedGlobals,60,4 |
| 17 | ; NO-MERGE: .zerofill __DATA,__bss,_bar,20,2 |
| 18 | ; NO-MERGE: .zerofill __DATA,__bss,_baz,20,2 |
| 19 | ; NO-MERGE: .zerofill __DATA,__bss,_foo,20,2 |
| 20 | ; NO-MERGE-NOT: .zerofill __DATA,__bss,__MergedGlobals,60,4 |
| 21 | |
| 22 | target 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" |
| 23 | target triple = "thumbv7-apple-ios3.0.0" |
| 24 | |
| 25 | @bar = internal global [5 x i32] zeroinitializer, align 4 |
| 26 | @baz = internal global [5 x i32] zeroinitializer, align 4 |
| 27 | @foo = internal global [5 x i32] zeroinitializer, align 4 |
| 28 | |
| 29 | ; Function Attrs: nounwind ssp |
| 30 | define internal void @initialize() #0 { |
| 31 | %1 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 32 | store i32 %1, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 0), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 33 | %2 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 34 | store i32 %2, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 0), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 35 | %3 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 36 | store i32 %3, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 1), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 37 | %4 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 38 | store i32 %4, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 1), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 39 | %5 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 40 | store i32 %5, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 2), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 41 | %6 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 42 | store i32 %6, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 2), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 43 | %7 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 44 | store i32 %7, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 3), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 45 | %8 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 46 | store i32 %8, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 3), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 47 | %9 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 48 | store i32 %9, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 4), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 49 | %10 = tail call i32 bitcast (i32 (...)* @calc to i32 ()*)() #3 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 50 | store i32 %10, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 4), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 51 | ret void |
| 52 | } |
| 53 | |
| 54 | declare i32 @calc(...) #1 |
| 55 | |
| 56 | ; Function Attrs: nounwind ssp |
| 57 | define internal void @calculate() #0 { |
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 58 | %1 = load <4 x i32>, <4 x i32>* bitcast ([5 x i32]* @bar to <4 x i32>*), align 4 |
| 59 | %2 = load <4 x i32>, <4 x i32>* bitcast ([5 x i32]* @baz to <4 x i32>*), align 4 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 60 | %3 = mul <4 x i32> %2, %1 |
| 61 | store <4 x i32> %3, <4 x i32>* bitcast ([5 x i32]* @foo to <4 x i32>*), align 4 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 62 | %4 = load i32, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @bar, i32 0, i32 4), align 4, !tbaa !1 |
| 63 | %5 = load i32, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @baz, i32 0, i32 4), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 64 | %6 = mul nsw i32 %5, %4 |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 65 | store i32 %6, i32* getelementptr inbounds ([5 x i32], [5 x i32]* @foo, i32 0, i32 4), align 4, !tbaa !1 |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 66 | ret void |
| 67 | } |
| 68 | |
| 69 | ; Function Attrs: nounwind readnone ssp |
| 70 | define internal i32* @returnFoo() #2 { |
| David Blaikie | f72d05b | 2015-03-13 18:20:45 +0000 | [diff] [blame] | 71 | ret i32* getelementptr inbounds ([5 x i32], [5 x i32]* @foo, i32 0, i32 0) |
| Jiangning Liu | b2ae37f | 2014-06-11 06:44:53 +0000 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | attributes #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" } |
| 75 | attributes #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" } |
| 76 | attributes #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" } |
| 77 | attributes #3 = { nounwind } |
| 78 | |
| 79 | !llvm.ident = !{!0} |
| 80 | |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 81 | !0 = !{!"LLVM version 3.4 "} |
| 82 | !1 = !{!2, !2, i64 0} |
| 83 | !2 = !{!"int", !3, i64 0} |
| 84 | !3 = !{!"omnipotent char", !4, i64 0} |
| 85 | !4 = !{!"Simple C/C++ TBAA"} |