[Outliner] Add tail call support
This commit adds tail call support to the MachineOutliner pass. This allows
the outliner to insert jumps rather than calls in areas where tail calling is
possible. Outlined tail calls include the return or terminator of the basic
block being outlined from.
Tail call support allows the outliner to take returns and terminators into
consideration while finding candidates to outline. It also allows the outliner
to save more instructions. For example, in the X86-64 outliner, a tail called
outlined function saves one instruction since no return has to be inserted.
llvm-svn: 297653
diff --git a/llvm/test/CodeGen/X86/machine-outliner.ll b/llvm/test/CodeGen/X86/machine-outliner.ll
index 9246348..9f8e6ec 100644
--- a/llvm/test/CodeGen/X86/machine-outliner.ll
+++ b/llvm/test/CodeGen/X86/machine-outliner.ll
@@ -15,7 +15,7 @@
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
- ; CHECK: callq l_OUTLINED_FUNCTION_1
+ ; CHECK: callq [[OFUNC1:l_OUTLINED_FUNCTION_[0-9]+]]
; CHECK: cmpl $0, -{{[0-9]+}}(%rbp)
store i32 1, i32* %2, align 4
store i32 2, i32* %3, align 4
@@ -30,7 +30,7 @@
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
- ; CHECK: callq l_OUTLINED_FUNCTION_1
+ ; CHECK: callq [[OFUNC1]]
store i32 1, i32* %2, align 4
store i32 2, i32* %3, align 4
store i32 3, i32* %4, align 4
@@ -79,13 +79,13 @@
store i32 0, i32* %1, align 4
store i32 0, i32* @x, align 4
- ; CHECK: callq l_OUTLINED_FUNCTION_0
+ ; CHECK: callq [[OFUNC2:l_OUTLINED_FUNCTION_[0-9]+]]
store i32 1, i32* %2, align 4
store i32 2, i32* %3, align 4
store i32 3, i32* %4, align 4
store i32 4, i32* %5, align 4
store i32 1, i32* @x, align 4
- ; CHECK: callq l_OUTLINED_FUNCTION_0
+ ; CHECK: callq [[OFUNC2]]
store i32 1, i32* %2, align 4
store i32 2, i32* %3, align 4
store i32 3, i32* %4, align 4
@@ -95,14 +95,14 @@
attributes #0 = { noredzone nounwind ssp uwtable "no-frame-pointer-elim"="true" }
-; CHECK-LABEL: l_OUTLINED_FUNCTION_0:
+; CHECK-LABEL: l_OUTLINED_FUNCTION_1:
; CHECK: movl $1, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl $2, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl $3, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl $4, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: retq
-; CHECK-LABEL: l_OUTLINED_FUNCTION_1:
+; CHECK-LABEL: l_OUTLINED_FUNCTION_0:
; CHECK: movl $1, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl $2, -{{[0-9]+}}(%rbp)
; CHECK-NEXT: movl $3, -{{[0-9]+}}(%rbp)