aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-09-13 07:33:34 +0000
committerJohn McCall <rjmccall@apple.com>2011-09-13 07:33:34 +0000
commitc5d9a90b3a3c16324e0cceeccec3d2993888deb6 (patch)
tree9e082546bb308b65092a8b56b9e3e19c93180687 /lib/CodeGen/CGObjC.cpp
parentd6ce22cd40c0a1fe7382158eab78e271796ca489 (diff)
Don't use native atomics on ivars whose size is not a power of two,
even on architectures that support unaligned access (which is the only way this is otherwise legal, given that ivars apparently do not honor alignment attributes). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139590 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r--lib/CodeGen/CGObjC.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index ca04a7b178..ddf6e1f98a 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -527,6 +527,14 @@ PropertyImplStrategy::PropertyImplStrategy(CodeGenModule &CGM,
// Otherwise, this is target-dependent and based on the size and
// alignment of the ivar.
+
+ // If the size of the ivar is not a power of two, give up. We don't
+ // want to get into the business of doing compare-and-swaps.
+ if (!IvarSize.isPowerOfTwo()) {
+ Kind = CopyStruct;
+ return;
+ }
+
llvm::Triple::ArchType arch =
CGM.getContext().getTargetInfo().getTriple().getArch();