diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index f3a948cf13f9c..ccda7ce8f41b9 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -842,15 +842,6 @@ static void emitStructGetterCall(CodeGenFunction &CGF, ObjCIvarDecl *ivar, callee, ReturnValueSlot(), args); } -/// Determine whether the given architecture supports unaligned atomic -/// accesses. They don't have to be fast, just faster than a function -/// call and a mutex. -static bool hasUnalignedAtomics(llvm::Triple::ArchType arch) { - // FIXME: Allow unaligned atomic load/store on x86. (It is not - // currently supported by the backend.) - return false; -} - /// Return the maximum size that permits atomic accesses for the given /// architecture. static CharUnits getMaxAtomicAccessSize(CodeGenModule &CGM, @@ -1023,14 +1014,6 @@ PropertyImplStrategy::PropertyImplStrategy(CodeGenModule &CGM, llvm::Triple::ArchType arch = CGM.getTarget().getTriple().getArch(); - // Most architectures require memory to fit within a single cache - // line, so the alignment has to be at least the size of the access. - // Otherwise we have to grab a lock. - if (IvarAlignment < IvarSize && !hasUnalignedAtomics(arch)) { - Kind = CopyStruct; - return; - } - // If the ivar's size exceeds the architecture's maximum atomic // access size, we have to use CopyStruct. if (IvarSize > getMaxAtomicAccessSize(CGM, arch)) { diff --git a/clang/test/CodeGenObjC/objc_copyStruct.m b/clang/test/CodeGenObjC/objc_copyStruct.m index 7bbad866e2b1f..8e52815a308ab 100644 --- a/clang/test/CodeGenObjC/objc_copyStruct.m +++ b/clang/test/CodeGenObjC/objc_copyStruct.m @@ -2,7 +2,7 @@ // RUN: %clang -target x86_64-apple-ios -fobjc-runtime=ios -Wno-objc-root-class -S -o - -emit-llvm %s | FileCheck %s struct S { - float f, g; + double f, g; }; @interface I @@ -13,4 +13,3 @@ @implementation I @end // CHECK: declare {{.*}}void @objc_copyStruct(ptr, ptr, i64, i1, i1) - diff --git a/clang/test/CodeGenObjC/property-aggregate.m b/clang/test/CodeGenObjC/property-aggregate.m index f4211b6b62bd5..4c8c8893f920f 100644 --- a/clang/test/CodeGenObjC/property-aggregate.m +++ b/clang/test/CodeGenObjC/property-aggregate.m @@ -1,13 +1,8 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s -// This structure's size is not a power of two, so the property does -// not get native atomics, even though x86-64 can do unaligned atomics -// with a lock prefix. struct s3 { char c[3]; }; // This structure's size is, so it does, because it can. -// FIXME: But we don't at the moment; the backend doesn't know how to generate -// correct code. struct s4 { char c[4]; }; @interface Test0 @@ -18,14 +13,8 @@ @implementation Test0 @synthesize s3, s4; @end -// CHECK: define internal i24 @"\01-[Test0 s3]"( -// CHECK: call void @objc_copyStruct -// CHECK: define internal void @"\01-[Test0 setS3:]"( -// CHECK: call void @objc_copyStruct -// CHECK: define internal i32 @"\01-[Test0 s4]"( -// CHECK: call void @objc_copyStruct -// CHECK: define internal void @"\01-[Test0 setS4:]"( -// CHECK: call void @objc_copyStruct +//// NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +// CHECK: {{.*}}