]> granicus.if.org Git - clang/commitdiff
Remove ivarlayout bitmap optimization, instead if all zeros,
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 24 Aug 2009 21:55:06 +0000 (21:55 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 24 Aug 2009 21:55:06 +0000 (21:55 +0000)
put out the bitmap when all objects are scanned.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79947 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjCMac.cpp
test/CodeGenObjC/ivar-layout-no-optimize.m [new file with mode: 0644]

index f97b80aa40994d443fd722a3e8db4446851c61fc..ab53ddea5562cc57d996644ba64f11cc0b2cc720 100644 (file)
@@ -3354,11 +3354,13 @@ llvm::Constant *CGObjCCommonMac::BuildIvarLayout(
         printf("0x%x%s",  s[i], s[i] != 0 ? ", " : "");
     printf("\n");
   }
-
+// Turn off this optimization.
+#if 0
   // if ivar_layout bitmap is all 1 bits (nothing skipped) then use NULL as
   // final layout.
   if (ForStrongLayout && !BytesSkipped)
     return llvm::Constant::getNullValue(PtrTy);
+#endif
   llvm::GlobalVariable * Entry =
     CreateMetadataVar("\01L_OBJC_CLASS_NAME_",
                       llvm::ConstantArray::get(VMContext, BitMap.c_str()),
diff --git a/test/CodeGenObjC/ivar-layout-no-optimize.m b/test/CodeGenObjC/ivar-layout-no-optimize.m
new file mode 100644 (file)
index 0000000..d7796bc
--- /dev/null
@@ -0,0 +1,18 @@
+// RUN: clang-cc -fobjc-gc -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s &&
+// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
+// RUN: true
+
+@interface NSObject {
+  id isa;
+}
+@end
+
+@interface AllPointers : NSObject {
+    id foo;
+    void *__strong bar;    NSObject *bletch;}
+@end
+@implementation AllPointers
+@end
+
+// CHECK-LP64: L_OBJC_CLASS_NAME_6:
+// CHECK-LP64-NEXT: .asciz     "\004"