# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --include-generated-funcs
# RUN: llc %s -mtriple aarch64 -outliner-leaf-descendants=false -debug-only=machine-outliner -run-pass=machine-outliner -o - 2>&1 | FileCheck %s
# RUN: llc %s -mtriple aarch64 -debug-only=machine-outliner -run-pass=machine-outliner -o - 2>&1 | FileCheck %s --check-prefix=CHECK-LEAF
# REQUIRES: asserts
# CHECK: *** Discarding overlapping candidates ***
# CHECK-NEXT:Searching for overlaps in all repeated sequences...
# CHECK-DAG: Sequence length: 7
# CHECK-NEXT: Candidates discarded: 0
# CHECK-NEXT: Candidates kept: 2
# CHECK-DAG: Sequence length: 8
# CHECK-NEXT: .. DISCARD candidate @ [12, 19]; overlaps with candidate @ [5, 12]
# CHECK-NEXT: Candidates discarded: 1
# CHECK-NEXT: Candidates kept: 1
# CHECK-DAG: Sequence length: 9
# CHECK-NEXT: .. DISCARD candidate @ [11, 19]; overlaps with candidate @ [4, 12]
# CHECK-NEXT: Candidates discarded: 1
# CHECK-NEXT: Candidates kept: 1
# CHECK-DAG: Sequence length: 10
# CHECK-NEXT: .. DISCARD candidate @ [10, 19]; overlaps with candidate @ [3, 12]
# CHECK-NEXT: Candidates discarded: 1
# CHECK-NEXT: Candidates kept: 1
# CHECK-DAG: Sequence length: 11
# CHECK-NEXT: .. DISCARD candidate @ [9, 19]; overlaps with candidate @ [2, 12]
# CHECK-NEXT: Candidates discarded: 1
# CHECK-NEXT: Candidates kept: 1
# CHECK-DAG: Sequence length: 12
# CHECK-NEXT: .. DISCARD candidate @ [8, 19]; overlaps with candidate @ [1, 12]
# CHECK-NEXT: Candidates discarded: 1
# CHECK-NEXT: Candidates kept: 1
# CHECK-DAG: Sequence length: 13
# CHECK-NEXT: .. DISCARD candidate @ [7, 19]; overlaps with candidate @ [0, 12]
# CHECK-NEXT: Candidates discarded: 1
# CHECK-NEXT: Candidates kept: 1
...
---
name: overlap
tracksRegLiveness: true
machineFunctionInfo:
hasRedZone: false
body: |
bb.0:
liveins: $x0, $x9
; CHECK-LABEL: name: overlap
; CHECK: liveins: $x0, $x9
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: BL @OUTLINED_FUNCTION_0, implicit-def $lr, implicit $sp, implicit-def $lr, implicit-def $x8, implicit-def $x9, implicit $sp, implicit $x0, implicit $x9
; CHECK-NEXT: BL @OUTLINED_FUNCTION_0, implicit-def $lr, implicit $sp, implicit-def $lr, implicit-def $x8, implicit-def $x9, implicit $sp, implicit $x0, implicit $x9
; CHECK-NEXT: RET undef $x9
; CHECK-LABEL: name: OUTLINED_FUNCTION_0
; CHECK: liveins: $x0, $x9, $lr
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: $x8 = ADDXri $x0, 3, 0
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-NEXT: RET $lr
; CHECK-LEAF-LABEL: name: overlap
; CHECK-LEAF: liveins: $x0, $x9
; CHECK-LEAF-NEXT: {{ $}}
; CHECK-LEAF-NEXT: BL @OUTLINED_FUNCTION_0
; CHECK-LEAF-NEXT: BL @OUTLINED_FUNCTION_0
; CHECK-LEAF-NEXT: $x8 = ADDXri $x0, 3, 0
; CHECK-LEAF-NEXT: BL @OUTLINED_FUNCTION_0
; CHECK-LEAF-NEXT: BL @OUTLINED_FUNCTION_0
; CHECK-LEAF-NEXT: $x8 = ADDXri $x0, 3, 0
; CHECK-LEAF-NEXT: BL @OUTLINED_FUNCTION_0
; CHECK-LEAF-NEXT: BL @OUTLINED_FUNCTION_0
; CHECK-LEAF-NEXT: RET undef $x9
; CHECK-LEAF-LABEL: name: OUTLINED_FUNCTION_0
; CHECK-LEAF: liveins: $x0, $x9, $lr
; CHECK-LEAF-NEXT: {{ $}}
; CHECK-LEAF-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-LEAF-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-LEAF-NEXT: $x9 = ADDXri $x9, 16, 0
; CHECK-LEAF-NEXT: RET $lr
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x8 = ADDXri $x0, 3, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x8 = ADDXri $x0, 3, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
$x9 = ADDXri $x9, 16, 0
RET undef $x9