Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Outliner] Add an option to only enable outlining of patterns above a…
… certain threshold Outlining isn't always a win when the saved instruction count is >= 1. The overhead of representing a new function in the binary depends on exception metadata and alignment. So parameterize this for local tuning. Reviewed By: paquette Differential Revision: https://reviews.llvm.org/D136774
- Loading branch information
Showing
2 changed files
with
121 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
llvm/test/CodeGen/AArch64/machine-outliner-threshold.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# RUN: llc -mtriple=aarch64--- -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s | ||
# RUN: llc -mtriple=aarch64--- -outliner-benefit-threshold=10 -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=THRESHOLD | ||
--- | | ||
|
||
define void @baz() #0 { | ||
ret void | ||
} | ||
|
||
define void @bar(i32 %a) #0 { | ||
ret void | ||
} | ||
|
||
attributes #0 = { noredzone } | ||
... | ||
--- | ||
# Check that two we outline two different sequences, one from bb1 and one from | ||
# bb2 when the threshold is 1. | ||
# CHECK-LABEL: bb.1: | ||
# CHECK: BL @OUTLINED_FUNCTION_[[F0:[0-9]+]], implicit-def $lr, implicit $sp | ||
# CHECK-NEXT: $w11 = ORRWri $wzr, 1 | ||
# CHECK-NEXT: $w11 = ORRWri $wzr, 1 | ||
# CHECK-NEXT: $w11 = ORRWri $wzr, 2 | ||
# CHECK-NEXT: BL @baz, implicit-def dead $lr, implicit $sp | ||
# CHECK-NEXT: BL @OUTLINED_FUNCTION_[[F0]], implicit-def $lr, implicit $sp | ||
# CHECK-NEXT: $w11 = ORRWri $wzr, 1 | ||
# CHECK-NEXT: $w11 = ORRWri $wzr, 1 | ||
# CHECK-NEXT: $w8 = ORRWri $wzr, 0 | ||
# CHECK-NOT: $w11 = KILL renamable $w11, implicit killed $w11 | ||
|
||
# CHECK-LABEL: bb.2: | ||
# CHECK: BL @OUTLINED_FUNCTION_[[F1:[0-9]+]], implicit-def $lr, implicit $sp | ||
# CHECK-NEXT: $w9 = ORRWri $wzr, 0 | ||
# CHECK-NEXT: BL @OUTLINED_FUNCTION_[[F1]], implicit-def $lr, implicit $sp | ||
# CHECK-NEXT: $w8 = ORRWri $wzr, 0 | ||
# CHECK-NOT: $w11 = KILL renamable $w11, implicit killed $w11 | ||
|
||
# Check that the sequences in bb.2 don't get outlined with a threshold of 10 but | ||
# the sequences in bb.1 do. | ||
# THRESHOLD-LABEL: bb.1: | ||
# THRESHOLD: BL @OUTLINED_FUNCTION_[[F0:[0-9]+]], implicit-def $lr, implicit $sp | ||
# THRESHOLD-NEXT: $w11 = ORRWri $wzr, 1 | ||
# THRESHOLD-NEXT: $w11 = ORRWri $wzr, 1 | ||
# THRESHOLD-NEXT: $w11 = ORRWri $wzr, 2 | ||
# THRESHOLD-NEXT: BL @baz, implicit-def dead $lr, implicit $sp | ||
# THRESHOLD-NEXT: BL @OUTLINED_FUNCTION_[[F0]], implicit-def $lr, implicit $sp | ||
# THRESHOLD-NEXT: $w11 = ORRWri $wzr, 1 | ||
# THRESHOLD-NEXT: $w11 = ORRWri $wzr, 1 | ||
# THRESHOLD-NEXT: $w8 = ORRWri $wzr, 0 | ||
# THRESHOLD-NOT: $w11 = KILL renamable $w11, implicit killed $w11 | ||
|
||
# THRESHOLD-LABEL: bb.2: | ||
# THRESHOLD-NOT: BL @OUTLINED_FUNCTION | ||
name: bar | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
liveins: $w0, $lr, $w8 | ||
$sp = frame-setup SUBXri $sp, 32, 0 | ||
$fp = frame-setup ADDXri $sp, 16, 0 | ||
bb.1: | ||
BL @baz, implicit-def dead $lr, implicit $sp | ||
$w11 = ORRWri $wzr, 1 | ||
$w11 = ORRWri $wzr, 1 | ||
$w11 = KILL renamable $w11, implicit killed $w11 | ||
$w11 = ORRWri $wzr, 1 | ||
$w11 = ORRWri $wzr, 1 | ||
BL @baz, implicit-def dead $lr, implicit $sp | ||
$w11 = ORRWri $wzr, 1 | ||
$w11 = ORRWri $wzr, 1 | ||
$w11 = ORRWri $wzr, 2 | ||
BL @baz, implicit-def dead $lr, implicit $sp | ||
$w11 = ORRWri $wzr, 1 | ||
$w11 = ORRWri $wzr, 1 | ||
$w11 = ORRWri $wzr, 1 | ||
$w11 = ORRWri $wzr, 1 | ||
BL @baz, implicit-def dead $lr, implicit $sp | ||
$w11 = ORRWri $wzr, 1 | ||
$w11 = ORRWri $wzr, 1 | ||
$w8 = ORRWri $wzr, 0 | ||
bb.2: | ||
$w15 = ORRWri $wzr, 1 | ||
$w15 = ORRWri $wzr, 1 | ||
$w15 = ORRWri $wzr, 1 | ||
$w15 = ORRWri $wzr, 1 | ||
$x15 = ADDXri $sp, 48, 0; | ||
$w9 = ORRWri $wzr, 0 | ||
$w15 = ORRWri $wzr, 1 | ||
$w15 = ORRWri $wzr, 1 | ||
$w15 = ORRWri $wzr, 1 | ||
$w15 = ORRWri $wzr, 1 | ||
$x15 = ADDXri $sp, 48, 0; | ||
$w8 = ORRWri $wzr, 0 | ||
bb.3: | ||
$fp, $lr = LDPXi $sp, 2 | ||
$sp = ADDXri $sp, 32, 0 | ||
RET undef $lr | ||
... | ||
--- | ||
name: baz | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
liveins: $w0, $lr, $w8 | ||
RET undef $lr | ||
# CHECK-LABEL: name: OUTLINED_FUNCTION_{{[0-9]}} | ||
# CHECK-LABEL: name: OUTLINED_FUNCTION_{{[1-9]}} | ||
|
||
# THRESHOLD-LABEL: name: OUTLINED_FUNCTION_{{[0-9]}} | ||
# THRESHOLD-NOT: name: OUTLINED_FUNCTION_{{[1-9]}} |