[PATCH] D94854: [Clang] Fix SwiftCallingConv's aggregate lowering for _Atomic(_Bool).

Varun Gandhi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 15 18:48:36 PST 2021


varungandhi-apple created this revision.
varungandhi-apple added reviewers: aschwaighofer, rjmccall.
Herald added a subscriber: jfb.
varungandhi-apple requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Fixes rdar://72999296.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94854

Files:
  clang/lib/CodeGen/SwiftCallingConv.cpp


Index: clang/lib/CodeGen/SwiftCallingConv.cpp
===================================================================
--- clang/lib/CodeGen/SwiftCallingConv.cpp
+++ clang/lib/CodeGen/SwiftCallingConv.cpp
@@ -99,6 +99,15 @@
     auto atomicSize = CGM.getContext().getTypeSizeInChars(atomicType);
     auto valueSize = CGM.getContext().getTypeSizeInChars(valueType);
 
+    auto valueTy = atomicType->getValueType();
+    // _Atomic(_Bool) does not correspond to i1.
+    if (valueTy == CGM.getContext().BoolTy) {
+      addTypedData(llvm::Type::getIntNTy(CGM.getLLVMContext(),
+                                         CGM.getContext().toBits(valueSize)),
+                   begin);
+    } else {
+      addTypedData(atomicType->getValueType(), begin);
+    }
     addTypedData(atomicType->getValueType(), begin);
 
     // Add atomic padding.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94854.317143.patch
Type: text/x-patch
Size: 840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210116/6ba519b0/attachment.bin>


More information about the cfe-commits mailing list