[PATCH] D10908: [CodeGen] Don't crash classifying a union of an AVX vector and an int

David Majnemer david.majnemer at gmail.com
Thu Jul 2 14:18:15 PDT 2015


majnemer created this revision.
majnemer added reviewers: asl, bruno, rjmccall, rnk.
majnemer added a subscriber: cfe-commits-list.

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.

http://reviews.llvm.org/D10908

Files:
  lib/CodeGen/TargetInfo.cpp
  test/CodeGenCXX/x86_64-arguments-avx.cpp

Index: test/CodeGenCXX/x86_64-arguments-avx.cpp
===================================================================
--- test/CodeGenCXX/x86_64-arguments-avx.cpp
+++ test/CodeGenCXX/x86_64-arguments-avx.cpp
@@ -50,3 +50,12 @@
   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; }
+}
Index: lib/CodeGen/TargetInfo.cpp
===================================================================
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -2094,11 +2094,13 @@
       //
       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;
       }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10908.28975.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150702/0fd4a5b6/attachment.bin>


More information about the cfe-commits mailing list