[llvm] r214981 - Don't count inreg params when mangling fastcall functions
Reid Kleckner
reid at kleckner.net
Wed Aug 6 11:09:05 PDT 2014
Author: rnk
Date: Wed Aug 6 13:09:04 2014
New Revision: 214981
URL: http://llvm.org/viewvc/llvm-project?rev=214981&view=rev
Log:
Don't count inreg params when mangling fastcall functions
This is consistent with MSVC.
Modified:
llvm/trunk/lib/IR/Mangler.cpp
llvm/trunk/test/CodeGen/X86/byval-callee-cleanup.ll
llvm/trunk/test/CodeGen/X86/musttail-indirect.ll
Modified: llvm/trunk/lib/IR/Mangler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Mangler.cpp?rev=214981&r1=214980&r2=214981&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Mangler.cpp (original)
+++ llvm/trunk/lib/IR/Mangler.cpp Wed Aug 6 13:09:04 2014
@@ -72,6 +72,9 @@ static void AddFastCallStdCallSuffix(raw
unsigned ArgWords = 0;
for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end();
AI != AE; ++AI) {
+ // Skip arguments in registers to handle typical fastcall lowering.
+ if (F->getAttributes().hasAttribute(AI->getArgNo() + 1, Attribute::InReg))
+ continue;
Type *Ty = AI->getType();
// 'Dereference' type in case of byval or inalloca parameter attribute.
if (AI->hasByValOrInAllocaAttr())
Modified: llvm/trunk/test/CodeGen/X86/byval-callee-cleanup.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/byval-callee-cleanup.ll?rev=214981&r1=214980&r2=214981&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/byval-callee-cleanup.ll (original)
+++ llvm/trunk/test/CodeGen/X86/byval-callee-cleanup.ll Wed Aug 6 13:09:04 2014
@@ -23,6 +23,5 @@ define x86_thiscallcc void @g(i8* %this,
define x86_fastcallcc void @h(i32 inreg %x, i32 inreg %y, %struct.Six* byval %a) {
ret void
}
-; FIXME: This should be @h at 8.
-; CHECK-LABEL: @h at 16:
+; CHECK-LABEL: @h at 8:
; CHECK: retl $8
Modified: llvm/trunk/test/CodeGen/X86/musttail-indirect.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/musttail-indirect.ll?rev=214981&r1=214980&r2=214981&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/musttail-indirect.ll (original)
+++ llvm/trunk/test/CodeGen/X86/musttail-indirect.ll Wed Aug 6 13:09:04 2014
@@ -109,7 +109,7 @@ entry:
ret i32 %3
}
-; CHECK-LABEL: @fastcall_thunk at 8:
+; CHECK-LABEL: @fastcall_thunk at 4:
; CHECK-NOT: mov %{{.*}}, {{.*(.*esp.*)}}
; CHECK: jmpl
; CHECK-NOT: ret
More information about the llvm-commits
mailing list