[llvm-commits] [llvm-gcc-4.2] r77276 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

Bill Wendling isanbard at gmail.com
Mon Jul 27 16:50:57 PDT 2009


Author: void
Date: Mon Jul 27 18:50:57 2009
New Revision: 77276

URL: http://llvm.org/viewvc/llvm-project?rev=77276&view=rev
Log:
LTO was stripping some Objective-C metadata symbols because IPSCCP thought that
they were dead. They weren't in the llvm.used list. Mark them as "preserve" so
that they're placed into the list.

The testcase for this is the SingleSource/UnitTests/ObjC/protocols.m file in
the test suite.

Modified:
    llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=77276&r1=77275&r2=77276&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Jul 27 18:50:57 2009
@@ -6200,6 +6200,9 @@
      follow from the alignments of the component types. */
   DECL_ALIGN(decl) = BITS_PER_WORD==32 ? 32 : 128;
   DECL_USER_ALIGN(decl) = 1;
+
+  /* Let optimizer know that this decl is not removable.  */
+  DECL_PRESERVE_P (decl) = 1;
 #endif
   /* LLVM LOCAL end */
   set_user_assembler_name (decl, buf);
@@ -12504,6 +12507,12 @@
       decl = create_hidden_decl (objc_protocol_type, string);
       DECL_WEAK (decl) = 1;
       set_user_assembler_name (decl, string);
+      /* LLVM LOCAL begin 7069676 */
+#ifdef ENABLE_LLVM
+      /* Let optimizer know that this decl is not removable.  */
+      DECL_PRESERVE_P (decl) = 1;
+#endif
+      /* LLVM LOCAL end 7069676 */
       expr = convert (objc_protocol_type, build_fold_addr_expr (expr));
       /* APPLE LOCAL radar 4561192 */
       objc_set_alignment_attribute (decl, objc_protocol_type);
@@ -12615,7 +12624,12 @@
   decl = create_hidden_decl (objc_protocol_type, buf);
   DECL_WEAK (decl) = 1;
   set_user_assembler_name (decl, buf);
-
+  /* LLVM LOCAL begin 7069676 */
+#ifdef ENABLE_LLVM
+  /* Let optimizer know that this decl is not removable.  */
+  DECL_PRESERVE_P (decl) = 1;
+#endif
+  /* LLVM LOCAL end 7069676 */
   return decl;
 }
 /* APPLE LOCAL end radar 6351990 */
@@ -14194,6 +14208,10 @@
   PROTOCOL_V2_FORWARD_DECL (p) = decl;
   /* LLVM LOCAL begin - radar 5476262 */
 #ifdef ENABLE_LLVM
+  /* begin radar 7069676 */
+  /* Let optimizer know that this decl is not removable.  */
+  DECL_PRESERVE_P (decl) = 1;
+  /* end radar 7069676 */
   pushdecl_top_level(decl);
 #endif
   /* LLVM LOCAL end - radar 5476262 */





More information about the llvm-commits mailing list