summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-08-06 18:09:04 +0000
committerReid Kleckner <reid@kleckner.net>2014-08-06 18:09:04 +0000
commit61bac93faa3b4102a9ba2e18e7c4ac3d4cabfaf7 (patch)
treef6455628e5f25c861448a640283fdd850133fdea
parente41d957028ddf5ff6fdd96c99f6a7fd9afa2358b (diff)
downloadbcm5719-llvm-61bac93faa3b4102a9ba2e18e7c4ac3d4cabfaf7.tar.gz
bcm5719-llvm-61bac93faa3b4102a9ba2e18e7c4ac3d4cabfaf7.zip
Don't count inreg params when mangling fastcall functions
This is consistent with MSVC. llvm-svn: 214981
-rw-r--r--llvm/lib/IR/Mangler.cpp3
-rw-r--r--llvm/test/CodeGen/X86/byval-callee-cleanup.ll3
-rw-r--r--llvm/test/CodeGen/X86/musttail-indirect.ll2
3 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp
index bfed3e39f4e..575141aed85 100644
--- a/llvm/lib/IR/Mangler.cpp
+++ b/llvm/lib/IR/Mangler.cpp
@@ -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())
diff --git a/llvm/test/CodeGen/X86/byval-callee-cleanup.ll b/llvm/test/CodeGen/X86/byval-callee-cleanup.ll
index 61e2369a404..4701f6d6d5a 100644
--- a/llvm/test/CodeGen/X86/byval-callee-cleanup.ll
+++ b/llvm/test/CodeGen/X86/byval-callee-cleanup.ll
@@ -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
diff --git a/llvm/test/CodeGen/X86/musttail-indirect.ll b/llvm/test/CodeGen/X86/musttail-indirect.ll
index 9d21b5ea5d5..f1286181ee5 100644
--- a/llvm/test/CodeGen/X86/musttail-indirect.ll
+++ b/llvm/test/CodeGen/X86/musttail-indirect.ll
@@ -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
OpenPOWER on IntegriCloud