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.
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.
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits