2016-08-01 13:56:57 +08:00
|
|
|
; RUN: llc -mtriple=aarch64-apple-ios -asm-verbose=false \
|
|
|
|
; RUN: -aarch64-enable-collect-loh=false -aarch64-enable-global-merge \
|
|
|
|
; RUN: -global-merge-group-by-use -global-merge-ignore-single-use %s -o - \
|
|
|
|
; RUN: | FileCheck %s
|
[GlobalMerge] Look at uses to create smaller global sets.
Instead of merging everything together, look at the users of
GlobalVariables, and try to group them by function, to create
sets of globals used "together".
Using that information, a less-aggressive alternative is to keep merging
everything together *except* globals that are only ever used alone, that
is, those for which it's clearly non-profitable to merge with others.
In my testing, grouping by Function is too aggressive, but grouping by
BasicBlock is too conservative. Anything in-between isn't trivially
available, so stick with Function grouping for now.
cl::opts are added for testing; both enabled by default.
A few of the testcases aren't testing the merging proper, but just
various edge cases when merging does occur. Update them to use the
previous grouping behavior. Also, one of the tests is unrelated to
GlobalMerge; change it accordingly.
While there, switch to r234666' flags rather than the brutal -O3.
Differential Revision: http://reviews.llvm.org/D8070
llvm-svn: 235249
2015-04-18 09:21:58 +08:00
|
|
|
|
|
|
|
; We assume that globals of the same size aren't reordered inside a set.
|
|
|
|
|
|
|
|
@m1 = internal global i32 0, align 4
|
|
|
|
@n1 = internal global i32 0, align 4
|
|
|
|
@o1 = internal global i32 0, align 4
|
|
|
|
|
|
|
|
; CHECK-LABEL: f1:
|
|
|
|
define void @f1(i32 %a1, i32 %a2) #0 {
|
2016-11-12 01:50:09 +08:00
|
|
|
; CHECK-NEXT: adrp x8, [[SET:__MergedGlobals]]@PAGE
|
[GlobalMerge] Look at uses to create smaller global sets.
Instead of merging everything together, look at the users of
GlobalVariables, and try to group them by function, to create
sets of globals used "together".
Using that information, a less-aggressive alternative is to keep merging
everything together *except* globals that are only ever used alone, that
is, those for which it's clearly non-profitable to merge with others.
In my testing, grouping by Function is too aggressive, but grouping by
BasicBlock is too conservative. Anything in-between isn't trivially
available, so stick with Function grouping for now.
cl::opts are added for testing; both enabled by default.
A few of the testcases aren't testing the merging proper, but just
various edge cases when merging does occur. Update them to use the
previous grouping behavior. Also, one of the tests is unrelated to
GlobalMerge; change it accordingly.
While there, switch to r234666' flags rather than the brutal -O3.
Differential Revision: http://reviews.llvm.org/D8070
llvm-svn: 235249
2015-04-18 09:21:58 +08:00
|
|
|
; CHECK-NEXT: add x8, x8, [[SET]]@PAGEOFF
|
|
|
|
; CHECK-NEXT: stp w0, w1, [x8]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
store i32 %a1, i32* @m1, align 4
|
|
|
|
store i32 %a2, i32* @n1, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
@m2 = internal global i32 0, align 4
|
|
|
|
@n2 = internal global i32 0, align 4
|
|
|
|
|
|
|
|
; CHECK-LABEL: f2:
|
|
|
|
define void @f2(i32 %a1, i32 %a2, i32 %a3) #0 {
|
|
|
|
; CHECK-NEXT: adrp x8, [[SET]]@PAGE
|
|
|
|
; CHECK-NEXT: add x8, x8, [[SET]]@PAGEOFF
|
|
|
|
; CHECK-NEXT: stp w0, w1, [x8]
|
|
|
|
; CHECK-NEXT: str w2, [x8, #8]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
store i32 %a1, i32* @m1, align 4
|
|
|
|
store i32 %a2, i32* @n1, align 4
|
|
|
|
store i32 %a3, i32* @o1, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: f3:
|
|
|
|
define void @f3(i32 %a1, i32 %a2) #0 {
|
2018-04-24 03:09:34 +08:00
|
|
|
; CHECK-NEXT: adrp x8, [[SET]]@PAGE+12
|
|
|
|
; CHECK-NEXT: add x8, x8, [[SET]]@PAGEOFF+12
|
|
|
|
; CHECK-NEXT: stp w0, w1, [x8]
|
[GlobalMerge] Look at uses to create smaller global sets.
Instead of merging everything together, look at the users of
GlobalVariables, and try to group them by function, to create
sets of globals used "together".
Using that information, a less-aggressive alternative is to keep merging
everything together *except* globals that are only ever used alone, that
is, those for which it's clearly non-profitable to merge with others.
In my testing, grouping by Function is too aggressive, but grouping by
BasicBlock is too conservative. Anything in-between isn't trivially
available, so stick with Function grouping for now.
cl::opts are added for testing; both enabled by default.
A few of the testcases aren't testing the merging proper, but just
various edge cases when merging does occur. Update them to use the
previous grouping behavior. Also, one of the tests is unrelated to
GlobalMerge; change it accordingly.
While there, switch to r234666' flags rather than the brutal -O3.
Differential Revision: http://reviews.llvm.org/D8070
llvm-svn: 235249
2015-04-18 09:21:58 +08:00
|
|
|
; CHECK-NEXT: ret
|
|
|
|
store i32 %a1, i32* @m2, align 4
|
|
|
|
store i32 %a2, i32* @n2, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
@o2 = internal global i32 0, align 4
|
|
|
|
|
|
|
|
; CHECK-LABEL: f4:
|
|
|
|
define void @f4(i32 %a1) #0 {
|
|
|
|
; CHECK-NEXT: adrp x8, _o2@PAGE
|
|
|
|
; CHECK-NEXT: str w0, [x8, _o2@PAGEOFF]
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
store i32 %a1, i32* @o2, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-06-06 22:48:32 +08:00
|
|
|
; CHECK-DAG: .zerofill __DATA,__bss,[[SET]],20,2
|
[GlobalMerge] Look at uses to create smaller global sets.
Instead of merging everything together, look at the users of
GlobalVariables, and try to group them by function, to create
sets of globals used "together".
Using that information, a less-aggressive alternative is to keep merging
everything together *except* globals that are only ever used alone, that
is, those for which it's clearly non-profitable to merge with others.
In my testing, grouping by Function is too aggressive, but grouping by
BasicBlock is too conservative. Anything in-between isn't trivially
available, so stick with Function grouping for now.
cl::opts are added for testing; both enabled by default.
A few of the testcases aren't testing the merging proper, but just
various edge cases when merging does occur. Update them to use the
previous grouping behavior. Also, one of the tests is unrelated to
GlobalMerge; change it accordingly.
While there, switch to r234666' flags rather than the brutal -O3.
Differential Revision: http://reviews.llvm.org/D8070
llvm-svn: 235249
2015-04-18 09:21:58 +08:00
|
|
|
; CHECK-DAG: .zerofill __DATA,__bss,_o2,4,2
|
|
|
|
|
|
|
|
attributes #0 = { nounwind }
|