]> granicus.if.org Git - llvm/commitdiff
Don't count inreg params when mangling fastcall functions
authorReid Kleckner <reid@kleckner.net>
Wed, 6 Aug 2014 18:09:04 +0000 (18:09 +0000)
committerReid Kleckner <reid@kleckner.net>
Wed, 6 Aug 2014 18:09:04 +0000 (18:09 +0000)
This is consistent with MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214981 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/Mangler.cpp
test/CodeGen/X86/byval-callee-cleanup.ll
test/CodeGen/X86/musttail-indirect.ll

index bfed3e39f4edb8448001a3d538c79554ae75778b..575141aed85bdf1f74d9283607a278375fd325bc 100644 (file)
@@ -72,6 +72,9 @@ static void AddFastCallStdCallSuffix(raw_ostream &OS, const Function *F,
   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())
index 61e2369a4042c971d5a96896d8828c519116f350..4701f6d6d5ac33ea6b190bfdfb03a70314886165 100644 (file)
@@ -23,6 +23,5 @@ define x86_thiscallcc void @g(i8* %this, %struct.Six* byval %a) {
 define x86_fastcallcc void @h(i32 inreg %x, i32 inreg %y, %struct.Six* byval %a) {
   ret void
 }
-; FIXME: This should be @h@8.
-; CHECK-LABEL: @h@16:
+; CHECK-LABEL: @h@8:
 ; CHECK: retl $8
index 9d21b5ea5d528add6f2e1c7c46b7c75a56232b8b..f1286181ee521db5c7a41fbcc4faedab5db1c4f6 100644 (file)
@@ -109,7 +109,7 @@ entry:
   ret i32 %3
 }
 
-; CHECK-LABEL: @fastcall_thunk@8:
+; CHECK-LABEL: @fastcall_thunk@4:
 ; CHECK-NOT: mov %{{.*}}, {{.*(.*esp.*)}}
 ; CHECK: jmpl
 ; CHECK-NOT: ret