[PATCH] D10907: [CodeGen] Correctly handle base classes which are passed in memory

David Majnemer david.majnemer at gmail.com
Tue Jul 7 22:14:47 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL241667: [CodeGen] Correctly handle base classes which are passed in memory (authored by majnemer).

Changed prior to commit:
  http://reviews.llvm.org/D10907?vs=28974&id=29242#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D10907

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

Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp
@@ -2073,8 +2073,10 @@
         classify(I.getType(), Offset, FieldLo, FieldHi, isNamedArg);
         Lo = merge(Lo, FieldLo);
         Hi = merge(Hi, FieldHi);
-        if (Lo == Memory || Hi == Memory)
-          break;
+        if (Lo == Memory || Hi == Memory) {
+          postMerge(Size, Lo, Hi);
+          return;
+        }
       }
     }
 
Index: cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp
===================================================================
--- cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp
+++ cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp
@@ -196,3 +196,19 @@
     return sret;
   }
 }
+
+namespace test10 {
+#pragma pack(1)
+struct BasePacked {
+  char one;
+  short two;
+};
+#pragma pack()
+struct DerivedPacked : public BasePacked {
+  int three;
+};
+// CHECK-LABEL: define i32 @_ZN6test1020FuncForDerivedPackedENS_13DerivedPackedE({{.*}}* byval align 8
+int FuncForDerivedPacked(DerivedPacked d) {
+  return d.three;
+}
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10907.29242.patch
Type: text/x-patch
Size: 1159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150708/25dad577/attachment.bin>


More information about the cfe-commits mailing list