From: David Majnemer Date: Wed, 8 Jul 2015 05:07:05 +0000 (+0000) Subject: [CodeGen] Don't crash classifying a union of an AVX vector and an int X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ba945b1f474847c2f814746f7dbe47040d09756;p=clang [CodeGen] Don't crash classifying a union of an AVX vector and an int We forgot to run postMerge after decided that the union had to be classified as MEMORY. This left us with Lo == MEMORY and Hi == SSEUp which is an invalid combination. This fixes PR24021. Differential Revision: http://reviews.llvm.org/D10908 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241666 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index e5ba200e1c..dbb9e8d903 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -2094,11 +2094,13 @@ void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase, // if (Size > 128 && getContext().getTypeSize(i->getType()) != 256) { Lo = Memory; + postMerge(Size, Lo, Hi); return; } // Note, skip this test for bit-fields, see below. if (!BitField && Offset % getContext().getTypeAlign(i->getType())) { Lo = Memory; + postMerge(Size, Lo, Hi); return; } diff --git a/test/CodeGenCXX/x86_64-arguments-avx.cpp b/test/CodeGenCXX/x86_64-arguments-avx.cpp index 29e693451d..2933d9445b 100644 --- a/test/CodeGenCXX/x86_64-arguments-avx.cpp +++ b/test/CodeGenCXX/x86_64-arguments-avx.cpp @@ -50,3 +50,12 @@ UU2 PR23082(UU2 x) { return x; } } + +namespace test3 { +union U { + __attribute__((__vector_size__(32))) float f1; + int f2; +}; +// CHECK: define i32 @_ZN5test31fENS_1UE({{.*}}* byval align 32 +int f(U u) { return u.f2; } +}