mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
5ca1dd864d
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
65 lines
1.8 KiB
LLVM
65 lines
1.8 KiB
LLVM
; RUN: llc -enable-machine-outliner -mtriple=aarch64-apple-darwin < %s | FileCheck %s -check-prefix=NoODR
|
|
; RUN: llc -enable-machine-outliner -enable-linkonceodr-outlining -mtriple=aarch64-apple-darwin < %s | FileCheck %s -check-prefix=ODR
|
|
|
|
define linkonce_odr void @fish() #0 {
|
|
; CHECK-LABEL: _fish:
|
|
; NoODR: orr w8, wzr, #0x1
|
|
; NoODR-NEXT: stp w8, wzr, [sp, #8]
|
|
; NoODR-NEXT: orr w8, wzr, #0x2
|
|
; NoODR-NEXT: str w8, [sp, #4]
|
|
; NoODR-NEXT: orr w8, wzr, #0x3
|
|
; NoODR-NEXT: str w8, [sp], #16
|
|
; NoODR-NEXT: ret
|
|
; ODR: b l_OUTLINED_FUNCTION_0
|
|
%1 = alloca i32, align 4
|
|
%2 = alloca i32, align 4
|
|
%3 = alloca i32, align 4
|
|
%4 = alloca i32, align 4
|
|
store i32 0, i32* %1, align 4
|
|
store i32 1, i32* %2, align 4
|
|
store i32 2, i32* %3, align 4
|
|
store i32 3, i32* %4, align 4
|
|
ret void
|
|
}
|
|
|
|
define void @cat() #0 {
|
|
; CHECK-LABEL: _cat:
|
|
; CHECK: b l_OUTLINED_FUNCTION_0
|
|
; CHECK-NOT: ret
|
|
%1 = alloca i32, align 4
|
|
%2 = alloca i32, align 4
|
|
%3 = alloca i32, align 4
|
|
%4 = alloca i32, align 4
|
|
store i32 0, i32* %1, align 4
|
|
store i32 1, i32* %2, align 4
|
|
store i32 2, i32* %3, align 4
|
|
store i32 3, i32* %4, align 4
|
|
ret void
|
|
}
|
|
|
|
define void @dog() #0 {
|
|
; CHECK-LABEL: _dog:
|
|
; CHECK: b l_OUTLINED_FUNCTION_0
|
|
; CHECK-NOT: ret
|
|
%1 = alloca i32, align 4
|
|
%2 = alloca i32, align 4
|
|
%3 = alloca i32, align 4
|
|
%4 = alloca i32, align 4
|
|
store i32 0, i32* %1, align 4
|
|
store i32 1, i32* %2, align 4
|
|
store i32 2, i32* %3, align 4
|
|
store i32 3, i32* %4, align 4
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: l_OUTLINED_FUNCTION_0:
|
|
; CHECK: orr w8, wzr, #0x1
|
|
; CHECK-NEXT: stp w8, wzr, [sp, #8]
|
|
; CHECK-NEXT: orr w8, wzr, #0x2
|
|
; CHECK-NEXT: str w8, [sp, #4]
|
|
; CHECK-NEXT: orr w8, wzr, #0x3
|
|
; CHECK-NEXT: str w8, [sp], #16
|
|
; CHECK-NEXT: ret
|
|
|
|
attributes #0 = { noredzone nounwind ssp uwtable "no-frame-pointer-elim"="false" "target-cpu"="cyclone" }
|