[llvm-commits] [llvm] r99598 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/pic.ll test/CodeGen/X86/sibcall.ll test/CodeGen/X86/xor-icmp.ll

Evan Cheng evan.cheng at apple.com
Thu Mar 25 22:15:45 PDT 2010


On Mar 25, 2010, at 7:27 PM, Jim Grosbach wrote:

> Is Outs only the variable portion of the argument list? If it includes the fixed portion, it'll never be empty for a varargs function, right?

Outs are all the arguments including the fixed portion. It can be empty. In fact it's very common because C is so awesome.

extern void bar();
void foo() {
  bar();
}

bar is a vararg function.

Evan

> 
> On Mar 25, 2010, at 7:13 PM, Evan Cheng wrote:
> 
>> Author: evancheng
>> Date: Thu Mar 25 21:13:13 2010
>> New Revision: 99598
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=99598&view=rev
>> Log:
>> Allow trivial sibcall of vararg callee when no arguments are being passed.
>> 
>> Modified:
>>   llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
>>   llvm/trunk/test/CodeGen/X86/pic.ll
>>   llvm/trunk/test/CodeGen/X86/sibcall.ll
>>   llvm/trunk/test/CodeGen/X86/xor-icmp.ll
>> 
>> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=99598&r1=99597&r2=99598&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
>> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Mar 25 21:13:13 2010
>> @@ -2301,8 +2301,9 @@
>>  // Look for obvious safe cases to perform tail call optimization that does not
>>  // requite ABI changes. This is what gcc calls sibcall.
>> 
>> -  // Do not sibcall optimize vararg calls for now.
>> -  if (isVarArg)
>> +  // Do not sibcall optimize vararg calls unless the call site is not passing any
>> +  // arguments.
>> +  if (isVarArg && !Outs.empty())
>>    return false;
>> 
>>  // Also avoid sibcall optimization if either caller or callee uses struct
>> 
>> Modified: llvm/trunk/test/CodeGen/X86/pic.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pic.ll?rev=99598&r1=99597&r2=99598&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/X86/pic.ll (original)
>> +++ llvm/trunk/test/CodeGen/X86/pic.ll Thu Mar 25 21:13:13 2010
>> @@ -194,10 +194,10 @@
>> 
>> ; LINUX: .LJTI8_0:
>> ; LINUX:   .long	 .LBB8_2 at GOTOFF
>> -; LINUX:   .long	 .LBB8_2 at GOTOFF
>> -; LINUX:   .long	 .LBB8_7 at GOTOFF
>> -; LINUX:   .long	 .LBB8_3 at GOTOFF
>> -; LINUX:   .long	 .LBB8_7 at GOTOFF
>> +; LINUX:   .long	 .LBB8_8 at GOTOFF
>> +; LINUX:   .long	 .LBB8_14 at GOTOFF
>> +; LINUX:   .long	 .LBB8_9 at GOTOFF
>> +; LINUX:   .long	 .LBB8_10 at GOTOFF
>> }
>> 
>> declare void @foo1(...)
>> 
>> Modified: llvm/trunk/test/CodeGen/X86/sibcall.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sibcall.ll?rev=99598&r1=99597&r2=99598&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/X86/sibcall.ll (original)
>> +++ llvm/trunk/test/CodeGen/X86/sibcall.ll Thu Mar 25 21:13:13 2010
>> @@ -271,3 +271,34 @@
>> }
>> 
>> declare double @bar4()
>> +
>> +; rdar://6283267
>> +define void @t17() nounwind ssp {
>> +entry:
>> +; 32: t17:
>> +; 32: jmp {{_?}}bar5
>> +
>> +; 64: t17:
>> +; 64: xorb %al, %al
>> +; 64: jmp {{_?}}bar5
>> +  tail call void (...)* @bar5() nounwind
>> +  ret void
>> +}
>> +
>> +declare void @bar5(...)
>> +
>> +; rdar://7774847
>> +define void @t18() nounwind ssp {
>> +entry:
>> +; 32: t18:
>> +; 32: call {{_?}}bar6
>> +; 32: fstp %st(0)
>> +
>> +; 64: t18:
>> +; 64: xorb %al, %al
>> +; 64: jmp {{_?}}bar6
>> +  %0 = tail call double (...)* @bar6() nounwind
>> +  ret void
>> +}
>> +
>> +declare double @bar6(...)
>> 
>> Modified: llvm/trunk/test/CodeGen/X86/xor-icmp.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xor-icmp.ll?rev=99598&r1=99597&r2=99598&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/CodeGen/X86/xor-icmp.ll (original)
>> +++ llvm/trunk/test/CodeGen/X86/xor-icmp.ll Thu Mar 25 21:13:13 2010
>> @@ -43,7 +43,7 @@
>> ; X32: cmpl
>> ; X32: sete
>> ; X32-NOT: xor
>> -; X32: je
>> +; X32: jne
>> 
>> ; X64: t2:
>> ; X64: testl
>> @@ -51,7 +51,7 @@
>> ; X64: testl
>> ; X64: sete
>> ; X64-NOT: xor
>> -; X64: je
>> +; X64: jne
>> entry:
>>  %0 = icmp eq i32 %x, 0                          ; <i1> [#uses=1]
>>  %1 = icmp eq i32 %y, 0                          ; <i1> [#uses=1]
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 





More information about the llvm-commits mailing list