1 # RUN: llc -march=riscv32 -x mir -run-pass=machine-outliner -simplify-mir -verify-machineinstrs < %s \
2 # RUN: | FileCheck -check-prefix=RV32I-MO %s
3 # RUN: llc -march=riscv64 -x mir -run-pass=machine-outliner -simplify-mir -verify-machineinstrs < %s \
4 # RUN: | FileCheck -check-prefix=RV64I-MO %s
7 define i32 @outline_0(i32 %a, i32 %b) { ret i32 0 }
9 define i32 @outline_1(i32 %a, i32 %b) { ret i32 0 }
11 define i32 @outline_2(i32 %a, i32 %b) { ret i32 0 }
13 ; Should not outline linkonce_odr functions which could be deduplicated by the
15 define linkonce_odr i32 @dont_outline_0(i32 %a, i32 %b) { ret i32 0 }
17 ; Should not outline functions with named linker sections
18 define i32 @dont_outline_1(i32 %a, i32 %b) section "named" { ret i32 0 }
20 ; Cannot outline if the X5 (t0) register is not free
21 define i32 @dont_outline_2(i32 %a, i32 %b) { ret i32 0 }
26 tracksRegLiveness: true
30 ; RV32I-MO-LABEL: name: outline_0
31 ; RV32I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
33 ; RV64I-MO-LABEL: name: outline_0
34 ; RV64I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
39 PseudoRET implicit $x10
44 tracksRegLiveness: true
48 ; RV32I-MO-LABEL: name: outline_1
49 ; RV32I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
51 ; RV64I-MO-LABEL: name: outline_1
52 ; RV64I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
57 PseudoRET implicit $x10
62 tracksRegLiveness: true
66 ; RV32I-MO-LABEL: name: outline_2
67 ; RV32I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
69 ; RV64I-MO-LABEL: name: outline_2
70 ; RV64I-MO: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
75 PseudoRET implicit $x10
80 tracksRegLiveness: true
84 ; RV32I-MO-LABEL: name: dont_outline_0
85 ; RV32I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
87 ; RV64I-MO-LABEL: name: dont_outline_0
88 ; RV64I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
93 PseudoRET implicit $x10
98 tracksRegLiveness: true
102 ; RV32I-MO-LABEL: name: dont_outline_1
103 ; RV32I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
105 ; RV64I-MO-LABEL: name: dont_outline_1
106 ; RV64I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
107 $x11 = ORI $x11, 1023
109 $x11 = AND $x12, $x11
110 $x10 = SUB $x10, $x11
111 PseudoRET implicit $x10
116 tracksRegLiveness: true
119 liveins: $x10, $x11, $x5
120 ; RV32I-MO-LABEL: name: dont_outline_2
121 ; RV32I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
123 ; RV64I-MO-LABEL: name: dont_outline_2
124 ; RV64I-MO-NOT: $x5 = PseudoCALLReg {{.*}} @OUTLINED_FUNCTION_0
125 $x11 = ORI $x11, 1023
127 $x11 = AND $x12, $x11
128 $x10 = SUB $x10, $x11
130 PseudoRET implicit $x10