From 20e95c5eb400c864bbd4421624fdf7b25ce70f56 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 12 May 2009 15:22:40 +0000 Subject: [PATCH] x86-64 ABI: clang incorrectly passes union { long double, float } in register. - Merge algorithm was returning MEMORY as it should. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71556 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGCall.cpp | 3 ++- test/CodeGen/x86_64-arguments.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index c46e7901d9..a142729343 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -633,7 +633,8 @@ X86_64ABIInfo::Class X86_64ABIInfo::merge(Class Accum, return Field; else if (Accum == Integer || Field == Integer) return Integer; - else if (Field == X87 || Field == X87Up || Field == ComplexX87) + else if (Field == X87 || Field == X87Up || Field == ComplexX87 || + Accum == X87 || Accum == X87Up) return Memory; else return SSE; diff --git a/test/CodeGen/x86_64-arguments.c b/test/CodeGen/x86_64-arguments.c index fa73f7de67..2e5debe7cb 100644 --- a/test/CodeGen/x86_64-arguments.c +++ b/test/CodeGen/x86_64-arguments.c @@ -52,4 +52,7 @@ struct s9 { int a; int b; int : 0; } f9(void) {} struct s10 { int a; int b; int : 0; }; void f10(struct s10 a0) {} +// RUN: grep 'define void @f11(.union.anon. noalias sret .agg.result)' %t && +union { long double a; float b; } f11() {} + // RUN: true -- 2.40.0