diff --git a/clang/lib/CodeGen/SwiftCallingConv.cpp b/clang/lib/CodeGen/SwiftCallingConv.cpp --- a/clang/lib/CodeGen/SwiftCallingConv.cpp +++ b/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 (const auto *atomicType = type->getAs()) { + addTypedData(atomicType->getValueType(), begin); - // Record types. - if (auto recType = type->getAs()) { + // Record types. + } else if (const auto *recType = type->getAs()) { addTypedData(recType->getDecl(), begin); // Array types. diff --git a/clang/test/CodeGen/64bit-swiftcall.c b/clang/test/CodeGen/64bit-swiftcall.c --- a/clang/test/CodeGen/64bit-swiftcall.c +++ b/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) {}