Perform trivial tail call optimization for callees with "C" ABI. These are done
even when -tailcallopt is not specified and it does not require changing ABI.
First case is the most trivial one. Perform tail call optimization when both
the caller and callee do not return values and when the callee does not take
any input arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94664 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/X86/pic.ll b/test/CodeGen/X86/pic.ll
index e886ba0..d3c28a0 100644
--- a/test/CodeGen/X86/pic.ll
+++ b/test/CodeGen/X86/pic.ll
@@ -190,7 +190,7 @@
 ; LINUX: .L8$pb:
 ; LINUX:   addl	$_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref8-.L8$pb),
 ; LINUX:   addl	.LJTI8_0@GOTOFF(
-; LINUX:   jmpl	*%ecx
+; LINUX:   jmpl	*
 
 ; LINUX: .LJTI8_0:
 ; LINUX:   .long	 .LBB8_2@GOTOFF
diff --git a/test/CodeGen/X86/tailcall1.ll b/test/CodeGen/X86/tailcall1.ll
index 42f8cdd..96c4cad 100644
--- a/test/CodeGen/X86/tailcall1.ll
+++ b/test/CodeGen/X86/tailcall1.ll
@@ -4,8 +4,8 @@
 
 define fastcc i32 @tailcaller(i32 %in1, i32 %in2) nounwind {
 entry:
-	%tmp11 = tail call fastcc i32 @tailcallee(i32 %in1, i32 %in2, i32 %in1, i32 %in2)
-	ret i32 %tmp11
+  %tmp11 = tail call fastcc i32 @tailcallee(i32 %in1, i32 %in2, i32 %in1, i32 %in2)
+  ret i32 %tmp11
 }
 
 declare fastcc i8* @alias_callee()
diff --git a/test/CodeGen/X86/tailcall2.ll b/test/CodeGen/X86/tailcall2.ll
new file mode 100644
index 0000000..f1eb152
--- /dev/null
+++ b/test/CodeGen/X86/tailcall2.ll
@@ -0,0 +1,12 @@
+; RUN: llc < %s -march=x86    -asm-verbose=false | FileCheck %s
+; RUN: llc < %s -march=x86-64 -asm-verbose=false | FileCheck %s
+
+define void @bar(i32 %x) nounwind ssp {
+entry:
+; CHECK: bar:
+; CHECK: jmp _foo
+  tail call void @foo() nounwind
+  ret void
+}
+
+declare void @foo()