2018-04-21 02:03:21 +08:00
|
|
|
; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=aarch64-apple-darwin < %s | FileCheck %s
|
2018-05-16 07:36:46 +08:00
|
|
|
; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=aarch64-apple-darwin -mcpu=cortex-a53 -enable-misched=false < %s | FileCheck %s
|
2018-04-21 02:03:21 +08:00
|
|
|
; RUN: llc -verify-machineinstrs -enable-machine-outliner -enable-linkonceodr-outlining -mtriple=aarch64-apple-darwin < %s | FileCheck %s -check-prefix=ODR
|
2018-10-30 04:27:07 +08:00
|
|
|
; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=aarch64-apple-darwin -stop-after=machine-outliner < %s | FileCheck %s -check-prefix=TARGET_FEATURES
|
|
|
|
|
|
|
|
; Make sure that we inherit target features from functions and make sure we have
|
|
|
|
; the right function attributes.
|
|
|
|
; TARGET_FEATURES: define internal void @OUTLINED_FUNCTION_{{[0-9]+}}()
|
|
|
|
; TARGET_FEATURES-SAME: #[[ATTR_NUM:[0-9]+]]
|
|
|
|
; TARGET_FEATURES-DAG: attributes #[[ATTR_NUM]] = {
|
|
|
|
; TARGET_FEATURES-SAME: minsize
|
|
|
|
; TARGET_FEATURES-SAME: optsize
|
|
|
|
; TARGET_FEATURES-SAME: "target-features"="+sse"
|
[MachineOutliner] Disable outlining from LinkOnceODRs by default
Say you have two identical linkonceodr functions, one in M1 and one in M2.
Say that the outliner outlines A,B,C from one function, and D,E,F from another
function (where letters are instructions). Now those functions are not
identical, and cannot be deduped. Locally to M1 and M2, these outlining
choices would be good-- to the whole program, however, this might not be true!
To mitigate this, this commit makes it so that the outliner sees linkonceodr
functions as unsafe to outline from. It also adds a flag,
-enable-linkonceodr-outlining, which allows the user to specify that they
want to outline from such functions when they know what they're doing.
Changing this handles most code size regressions in the test suite caused by
competing with linker dedupe. It also doesn't have a huge impact on the code
size improvements from the outliner. There are 6 tests that regress > 5% from
outlining WITH linkonceodrs to outlining WITHOUT linkonceodrs. Overall, most
tests either improve or are not impacted.
Not outlined vs outlined without linkonceodrs:
https://hastebin.com/raw/qeguxavuda
Not outlined vs outlined with linkonceodrs:
https://hastebin.com/raw/edepoqoqic
Outlined with linkonceodrs vs outlined without linkonceodrs:
https://hastebin.com/raw/awiqifiheb
Numbers generated using compare.py with -m size.__text. Tests run for AArch64
with -Oz -mllvm -enable-machine-outliner -mno-red-zone.
llvm-svn: 315136
2017-10-07 08:16:34 +08:00
|
|
|
|
|
|
|
define linkonce_odr void @fish() #0 {
|
|
|
|
; CHECK-LABEL: _fish:
|
2018-04-04 05:36:00 +08:00
|
|
|
; CHECK-NOT: OUTLINED
|
|
|
|
; ODR: [[OUTLINED:OUTLINED_FUNCTION_[0-9]+]]
|
[MachineOutliner] Disable outlining from LinkOnceODRs by default
Say you have two identical linkonceodr functions, one in M1 and one in M2.
Say that the outliner outlines A,B,C from one function, and D,E,F from another
function (where letters are instructions). Now those functions are not
identical, and cannot be deduped. Locally to M1 and M2, these outlining
choices would be good-- to the whole program, however, this might not be true!
To mitigate this, this commit makes it so that the outliner sees linkonceodr
functions as unsafe to outline from. It also adds a flag,
-enable-linkonceodr-outlining, which allows the user to specify that they
want to outline from such functions when they know what they're doing.
Changing this handles most code size regressions in the test suite caused by
competing with linker dedupe. It also doesn't have a huge impact on the code
size improvements from the outliner. There are 6 tests that regress > 5% from
outlining WITH linkonceodrs to outlining WITHOUT linkonceodrs. Overall, most
tests either improve or are not impacted.
Not outlined vs outlined without linkonceodrs:
https://hastebin.com/raw/qeguxavuda
Not outlined vs outlined with linkonceodrs:
https://hastebin.com/raw/edepoqoqic
Outlined with linkonceodrs vs outlined without linkonceodrs:
https://hastebin.com/raw/awiqifiheb
Numbers generated using compare.py with -m size.__text. Tests run for AArch64
with -Oz -mllvm -enable-machine-outliner -mno-red-zone.
llvm-svn: 315136
2017-10-07 08:16:34 +08:00
|
|
|
%1 = alloca i32, align 4
|
|
|
|
%2 = alloca i32, align 4
|
|
|
|
%3 = alloca i32, align 4
|
|
|
|
%4 = alloca i32, align 4
|
2018-05-17 05:20:16 +08:00
|
|
|
%5 = alloca i32, align 4
|
|
|
|
%6 = alloca i32, align 4
|
|
|
|
store i32 1, i32* %1, align 4
|
|
|
|
store i32 2, i32* %2, align 4
|
|
|
|
store i32 3, i32* %3, align 4
|
|
|
|
store i32 4, i32* %4, align 4
|
|
|
|
store i32 5, i32* %5, align 4
|
|
|
|
store i32 6, i32* %6, align 4
|
[MachineOutliner] Disable outlining from LinkOnceODRs by default
Say you have two identical linkonceodr functions, one in M1 and one in M2.
Say that the outliner outlines A,B,C from one function, and D,E,F from another
function (where letters are instructions). Now those functions are not
identical, and cannot be deduped. Locally to M1 and M2, these outlining
choices would be good-- to the whole program, however, this might not be true!
To mitigate this, this commit makes it so that the outliner sees linkonceodr
functions as unsafe to outline from. It also adds a flag,
-enable-linkonceodr-outlining, which allows the user to specify that they
want to outline from such functions when they know what they're doing.
Changing this handles most code size regressions in the test suite caused by
competing with linker dedupe. It also doesn't have a huge impact on the code
size improvements from the outliner. There are 6 tests that regress > 5% from
outlining WITH linkonceodrs to outlining WITHOUT linkonceodrs. Overall, most
tests either improve or are not impacted.
Not outlined vs outlined without linkonceodrs:
https://hastebin.com/raw/qeguxavuda
Not outlined vs outlined with linkonceodrs:
https://hastebin.com/raw/edepoqoqic
Outlined with linkonceodrs vs outlined without linkonceodrs:
https://hastebin.com/raw/awiqifiheb
Numbers generated using compare.py with -m size.__text. Tests run for AArch64
with -Oz -mllvm -enable-machine-outliner -mno-red-zone.
llvm-svn: 315136
2017-10-07 08:16:34 +08:00
|
|
|
ret void
|
|
|
|
}
|
2017-03-18 06:26:55 +08:00
|
|
|
|
2018-04-27 08:21:34 +08:00
|
|
|
define void @turtle() section "TURTLE,turtle" {
|
|
|
|
; CHECK-LABEL: _turtle:
|
|
|
|
; ODR-LABEL: _turtle:
|
|
|
|
; CHECK-NOT: OUTLINED
|
|
|
|
%1 = alloca i32, align 4
|
|
|
|
%2 = alloca i32, align 4
|
|
|
|
%3 = alloca i32, align 4
|
|
|
|
%4 = alloca i32, align 4
|
2018-05-17 05:20:16 +08:00
|
|
|
%5 = alloca i32, align 4
|
|
|
|
%6 = alloca i32, align 4
|
|
|
|
store i32 1, i32* %1, align 4
|
|
|
|
store i32 2, i32* %2, align 4
|
|
|
|
store i32 3, i32* %3, align 4
|
|
|
|
store i32 4, i32* %4, align 4
|
|
|
|
store i32 5, i32* %5, align 4
|
|
|
|
store i32 6, i32* %6, align 4
|
2018-04-27 08:21:34 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2017-03-18 06:26:55 +08:00
|
|
|
define void @cat() #0 {
|
[MachineOutliner] Disable outlining from LinkOnceODRs by default
Say you have two identical linkonceodr functions, one in M1 and one in M2.
Say that the outliner outlines A,B,C from one function, and D,E,F from another
function (where letters are instructions). Now those functions are not
identical, and cannot be deduped. Locally to M1 and M2, these outlining
choices would be good-- to the whole program, however, this might not be true!
To mitigate this, this commit makes it so that the outliner sees linkonceodr
functions as unsafe to outline from. It also adds a flag,
-enable-linkonceodr-outlining, which allows the user to specify that they
want to outline from such functions when they know what they're doing.
Changing this handles most code size regressions in the test suite caused by
competing with linker dedupe. It also doesn't have a huge impact on the code
size improvements from the outliner. There are 6 tests that regress > 5% from
outlining WITH linkonceodrs to outlining WITHOUT linkonceodrs. Overall, most
tests either improve or are not impacted.
Not outlined vs outlined without linkonceodrs:
https://hastebin.com/raw/qeguxavuda
Not outlined vs outlined with linkonceodrs:
https://hastebin.com/raw/edepoqoqic
Outlined with linkonceodrs vs outlined without linkonceodrs:
https://hastebin.com/raw/awiqifiheb
Numbers generated using compare.py with -m size.__text. Tests run for AArch64
with -Oz -mllvm -enable-machine-outliner -mno-red-zone.
llvm-svn: 315136
2017-10-07 08:16:34 +08:00
|
|
|
; CHECK-LABEL: _cat:
|
2018-04-04 05:36:00 +08:00
|
|
|
; CHECK: [[OUTLINED:OUTLINED_FUNCTION_[0-9]+]]
|
|
|
|
; ODR: [[OUTLINED]]
|
2017-03-18 06:26:55 +08:00
|
|
|
%1 = alloca i32, align 4
|
|
|
|
%2 = alloca i32, align 4
|
|
|
|
%3 = alloca i32, align 4
|
|
|
|
%4 = alloca i32, align 4
|
2018-05-17 05:20:16 +08:00
|
|
|
%5 = alloca i32, align 4
|
|
|
|
%6 = alloca i32, align 4
|
|
|
|
store i32 1, i32* %1, align 4
|
|
|
|
store i32 2, i32* %2, align 4
|
|
|
|
store i32 3, i32* %3, align 4
|
|
|
|
store i32 4, i32* %4, align 4
|
|
|
|
store i32 5, i32* %5, align 4
|
|
|
|
store i32 6, i32* %6, align 4
|
2017-03-18 06:26:55 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @dog() #0 {
|
[MachineOutliner] Disable outlining from LinkOnceODRs by default
Say you have two identical linkonceodr functions, one in M1 and one in M2.
Say that the outliner outlines A,B,C from one function, and D,E,F from another
function (where letters are instructions). Now those functions are not
identical, and cannot be deduped. Locally to M1 and M2, these outlining
choices would be good-- to the whole program, however, this might not be true!
To mitigate this, this commit makes it so that the outliner sees linkonceodr
functions as unsafe to outline from. It also adds a flag,
-enable-linkonceodr-outlining, which allows the user to specify that they
want to outline from such functions when they know what they're doing.
Changing this handles most code size regressions in the test suite caused by
competing with linker dedupe. It also doesn't have a huge impact on the code
size improvements from the outliner. There are 6 tests that regress > 5% from
outlining WITH linkonceodrs to outlining WITHOUT linkonceodrs. Overall, most
tests either improve or are not impacted.
Not outlined vs outlined without linkonceodrs:
https://hastebin.com/raw/qeguxavuda
Not outlined vs outlined with linkonceodrs:
https://hastebin.com/raw/edepoqoqic
Outlined with linkonceodrs vs outlined without linkonceodrs:
https://hastebin.com/raw/awiqifiheb
Numbers generated using compare.py with -m size.__text. Tests run for AArch64
with -Oz -mllvm -enable-machine-outliner -mno-red-zone.
llvm-svn: 315136
2017-10-07 08:16:34 +08:00
|
|
|
; CHECK-LABEL: _dog:
|
2018-04-04 05:36:00 +08:00
|
|
|
; CHECK: [[OUTLINED]]
|
|
|
|
; ODR: [[OUTLINED]]
|
2017-03-18 06:26:55 +08:00
|
|
|
%1 = alloca i32, align 4
|
|
|
|
%2 = alloca i32, align 4
|
|
|
|
%3 = alloca i32, align 4
|
|
|
|
%4 = alloca i32, align 4
|
2018-05-17 05:20:16 +08:00
|
|
|
%5 = alloca i32, align 4
|
|
|
|
%6 = alloca i32, align 4
|
|
|
|
store i32 1, i32* %1, align 4
|
|
|
|
store i32 2, i32* %2, align 4
|
|
|
|
store i32 3, i32* %3, align 4
|
|
|
|
store i32 4, i32* %4, align 4
|
|
|
|
store i32 5, i32* %5, align 4
|
|
|
|
store i32 6, i32* %6, align 4
|
2017-03-18 06:26:55 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2018-04-04 05:36:00 +08:00
|
|
|
; ODR: [[OUTLINED]]:
|
2018-05-16 07:36:46 +08:00
|
|
|
; CHECK: .p2align 2
|
|
|
|
; CHECK-NEXT: [[OUTLINED]]:
|
2018-05-17 05:20:16 +08:00
|
|
|
; CHECK: orr w8, wzr, #0x1
|
2018-07-31 01:45:28 +08:00
|
|
|
; CHECK-NEXT: str w8, [sp, #28]
|
2018-05-17 05:20:16 +08:00
|
|
|
; CHECK-NEXT: orr w8, wzr, #0x2
|
2018-07-31 01:45:28 +08:00
|
|
|
; CHECK-NEXT: str w8, [sp, #24]
|
2018-05-17 05:20:16 +08:00
|
|
|
; CHECK-NEXT: orr w8, wzr, #0x3
|
2018-07-31 01:45:28 +08:00
|
|
|
; CHECK-NEXT: str w8, [sp, #20]
|
2018-05-17 05:20:16 +08:00
|
|
|
; CHECK-NEXT: orr w8, wzr, #0x4
|
2018-07-31 01:45:28 +08:00
|
|
|
; CHECK-NEXT: str w8, [sp, #16]
|
2018-05-17 05:20:16 +08:00
|
|
|
; CHECK-NEXT: mov w8, #5
|
2018-07-31 01:45:28 +08:00
|
|
|
; CHECK-NEXT: str w8, [sp, #12]
|
2018-05-17 05:20:16 +08:00
|
|
|
; CHECK-NEXT: orr w8, wzr, #0x6
|
2018-07-31 01:45:28 +08:00
|
|
|
; CHECK-NEXT: str w8, [sp, #8]
|
2018-12-02 05:24:06 +08:00
|
|
|
; CHECK-NEXT: add sp, sp, #32
|
2017-03-18 06:26:55 +08:00
|
|
|
; CHECK-NEXT: ret
|
|
|
|
|
2018-10-30 04:27:07 +08:00
|
|
|
attributes #0 = { noredzone "target-cpu"="cyclone" "target-features"="+sse" }
|