aschwaighofer created this revision.
aschwaighofer added a reviewer: rjmccall.
Herald added subscribers: cfe-commits, jfb.
Herald added a project: clang.
aschwaighofer requested review of this revision.

rdar://67351073


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86218

Files:
  clang/lib/CodeGen/SwiftCallingConv.cpp
  clang/test/CodeGen/64bit-swiftcall.c


Index: clang/test/CodeGen/64bit-swiftcall.c
===================================================================
--- clang/test/CodeGen/64bit-swiftcall.c
+++ clang/test/CodeGen/64bit-swiftcall.c
@@ -1042,3 +1042,15 @@
   // CHECK-NOT: call void @llvm.lifetime.
   take_int5(return_int5());
 }
+
+typedef struct {
+  unsigned long long a;
+  unsigned long long b;
+} double_word;
+
+typedef struct {
+  _Atomic(double_word) a;
+} atomic_double_word;
+
+// CHECK-LABEL: use_atomic(i64 %0, i64 %1)
+SWIFTCALL void use_atomic(atomic_double_word a) {}
Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===================================================================
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -62,9 +62,12 @@
 
 void SwiftAggLowering::addTypedData(QualType type, CharUnits begin) {
   // Deal with various aggregate types as special cases:
+  // Atomic types.
+  if (auto atomicType = type->getAs<AtomicType>()) {
+    addTypedData(atomicType->getValueType(), begin);
 
-  // Record types.
-  if (auto recType = type->getAs<RecordType>()) {
+    // Record types.
+  } else if (auto recType = type->getAs<RecordType>()) {
     addTypedData(recType->getDecl(), begin);
 
   // Array types.


Index: clang/test/CodeGen/64bit-swiftcall.c
===================================================================
--- clang/test/CodeGen/64bit-swiftcall.c
+++ clang/test/CodeGen/64bit-swiftcall.c
@@ -1042,3 +1042,15 @@
   // CHECK-NOT: call void @llvm.lifetime.
   take_int5(return_int5());
 }
+
+typedef struct {
+  unsigned long long a;
+  unsigned long long b;
+} double_word;
+
+typedef struct {
+  _Atomic(double_word) a;
+} atomic_double_word;
+
+// CHECK-LABEL: use_atomic(i64 %0, i64 %1)
+SWIFTCALL void use_atomic(atomic_double_word a) {}
Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===================================================================
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -62,9 +62,12 @@
 
 void SwiftAggLowering::addTypedData(QualType type, CharUnits begin) {
   // Deal with various aggregate types as special cases:
+  // Atomic types.
+  if (auto atomicType = type->getAs<AtomicType>()) {
+    addTypedData(atomicType->getValueType(), begin);
 
-  // Record types.
-  if (auto recType = type->getAs<RecordType>()) {
+    // Record types.
+  } else if (auto recType = type->getAs<RecordType>()) {
     addTypedData(recType->getDecl(), begin);
 
   // Array types.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to