Index: lib/CodeGen/CGObjC.cpp =================================================================== --- lib/CodeGen/CGObjC.cpp +++ lib/CodeGen/CGObjC.cpp @@ -1010,7 +1010,7 @@ AutoreleaseResult = false; } - value = Builder.CreateBitCast(value, ConvertType(propType)); + value = Builder.CreateZExtOrBitCast(value, ConvertType(propType)); value = Builder.CreateBitCast( value, ConvertType(GetterMethodDecl->getReturnType())); } Index: test/CodeGenObjC/property-atomic-bool.m =================================================================== --- /dev/null +++ test/CodeGenObjC/property-atomic-bool.m @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -triple x86_64-apple-macosx10 -emit-llvm -x objective-c %s -o - | FileCheck %s + +// CHECK: define internal i8 @"\01-[A p]"( +// CHECK: %[[ATOMIC_LOAD:.*]] = load atomic i8, i8* %{{.*}} seq_cst +// CHECK: %[[TOBOOL:.*]] = trunc i8 %[[ATOMIC_LOAD]] to i1 +// CHECK: %[[RETVAL:.*]] = zext i1 %[[TOBOOL]] to i8 +// CHECK: ret i8 %[[RETVAL]] + +@interface A +@property(nonatomic) _Atomic(_Bool) p; +@end +@implementation A +@end