1 ; RUN: llc < %s -verify-machineinstrs -enable-machine-outliner | FileCheck %s
3 target triple = "aarch64-unknown-linux-gnu"
5 declare void @foo(i32, i32, i32, i32) minsize
7 ;; TargetOpcode::FENTRY_CALL at the start of the function expands to a __fentry__
8 ;; call which must be present. Don't outline it.
9 define void @fentry0(i1 %a) nounwind "fentry-call"="true" {
10 ; CHECK-LABEL: fentry0:
11 ; CHECK-NEXT: // %bb.0:
12 ; CHECK-NEXT: # FEntry call
14 ; CHECK-NEXT: bl [[OUTLINED_FUNCTION:OUTLINED_FUNCTION_[0-9]+]]
16 br i1 %a, label %if.then, label %if.end
18 call void @foo(i32 1, i32 2, i32 3, i32 4)
21 call void @foo(i32 5, i32 6, i32 7, i32 8)
25 define void @fentry1(i1 %a) nounwind "fentry-call"="true" {
26 ; CHECK-LABEL: fentry1:
27 ; CHECK-NEXT: // %bb.0:
28 ; CHECK-NEXT: # FEntry call
30 ; CHECK-NEXT: bl [[OUTLINED_FUNCTION]]
32 br i1 %a, label %if.then, label %if.end
34 call void @foo(i32 1, i32 2, i32 3, i32 4)
37 call void @foo(i32 5, i32 6, i32 7, i32 8)
41 ;; TargetOpcode::PATCHABLE_FUNCTION_ENTER at the start of the function expands to
42 ;; NOPs which must be present. Don't outline them.
43 define void @patchable0(i1 %a) nounwind "patchable-function-entry"="2" {
44 ; CHECK-LABEL: patchable0:
45 ; CHECK-NEXT: .Lfunc_begin0:
46 ; CHECK-NEXT: // %bb.0:
50 ; CHECK-NEXT: bl [[OUTLINED_FUNCTION]]
52 br i1 %a, label %if.then, label %if.end
54 call void @foo(i32 1, i32 2, i32 3, i32 4)
57 call void @foo(i32 5, i32 6, i32 7, i32 8)
61 define void @patchable1(i1 %a) nounwind "patchable-function-entry"="2" {
62 ; CHECK-LABEL: patchable1:
63 ; CHECK-NEXT: .Lfunc_begin1:
64 ; CHECK-NEXT: // %bb.0:
68 ; CHECK-NEXT: bl [[OUTLINED_FUNCTION]]
70 br i1 %a, label %if.then, label %if.end
72 call void @foo(i32 1, i32 2, i32 3, i32 4)
75 call void @foo(i32 5, i32 6, i32 7, i32 8)
79 ;; Similar to "patchable-function-entry".
80 define void @xray0(i1 %a) nounwind "function-instrument"="xray-always" {
82 ; CHECK-NEXT: .Lfunc_begin2:
83 ; CHECK-NEXT: // %bb.0:
84 ; CHECK-NEXT: .p2align 2
85 ; CHECK-NEXT: .Lxray_sled_0:
87 ; CHECK-NEXT: bl [[OUTLINED_FUNCTION]]
89 br i1 %a, label %if.then, label %if.end
91 call void @foo(i32 1, i32 2, i32 3, i32 4)
94 call void @foo(i32 5, i32 6, i32 7, i32 8)
98 define void @xray1(i1 %a) nounwind "function-instrument"="xray-always" {
100 ; CHECK-NEXT: .Lfunc_begin3:
101 ; CHECK-NEXT: // %bb.0:
102 ; CHECK-NEXT: .p2align 2
103 ; CHECK-NEXT: .Lxray_sled_2:
105 ; CHECK-NEXT: bl [[OUTLINED_FUNCTION]]
107 br i1 %a, label %if.then, label %if.end
109 call void @foo(i32 1, i32 2, i32 3, i32 4)
112 call void @foo(i32 5, i32 6, i32 7, i32 8)
116 ;; Make sure that OUTLINED_FUNCTION contains the right instructions
117 ; CHECK: [[OUTLINED_FUNCTION]]:
118 ; CHECK-NEXT: // %bb.0:
119 ; CHECK-NEXT: mov w0, #1
120 ; CHECK-NEXT: mov w1, #2
121 ; CHECK-NEXT: mov w2, #3
122 ; CHECK-NEXT: mov w3, #4