From 6d9eae69a07d6ea55bad53eff217ea2f0737e5a0 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Mon, 24 Aug 2009 21:55:06 +0000 Subject: [PATCH] Remove ivarlayout bitmap optimization, instead if all zeros, 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 | 4 +++- test/CodeGenObjC/ivar-layout-no-optimize.m | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 test/CodeGenObjC/ivar-layout-no-optimize.m diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index f97b80aa40..ab53ddea55 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -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 index 0000000000..d7796bc279 --- /dev/null +++ b/test/CodeGenObjC/ivar-layout-no-optimize.m @@ -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" -- 2.40.0