[llvm-commits] [llvm-gcc-4.2] r99629 - /llvm-gcc-4.2/trunk/gcc/gimplify.c
Chris Lattner
sabre at nondot.org
Fri Mar 26 11:41:06 PDT 2010
Author: lattner
Date: Fri Mar 26 13:41:06 2010
New Revision: 99629
URL: http://llvm.org/viewvc/llvm-project?rev=99629&view=rev
Log:
disable a minor optimization on darwin. For code like this:
extern int a, b, c, d;
void foo() {
int *Arr[] = {&a, &b, &c, &d, &a, &b, &c, &d, &a, &b, &c, &d, &a, &b, &c, &d,
&a, &b, &c, &d, &a, &b, &c, &d, &a, &b, &c, &d, &a, &b, &c, &d };
bar(Arr);
}
the compiler synthesizes a global variable for the temporary array and then
memcpy's from it to Arr. This is all great, but emitting the temporary global
with an L label on darwin fouls up atomization and can thus break dead code
stripping.
The right answer is to use an 'l' label without .globl, but this will require
introducing a yet-another new linkage type to llvm, which I'll do later.
This fixes rdar://7233622
Modified:
llvm-gcc-4.2/trunk/gcc/gimplify.c
Modified: llvm-gcc-4.2/trunk/gcc/gimplify.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/gimplify.c?rev=99629&r1=99628&r2=99629&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/gimplify.c (original)
+++ llvm-gcc-4.2/trunk/gcc/gimplify.c Fri Mar 26 13:41:06 2010
@@ -3097,9 +3097,16 @@
TREE_STATIC (new) = 1;
TREE_READONLY (new) = 1;
/* LLVM LOCAL begin */
+ /* On Darwin, we can't emit temporaries like this with private
+ * linkage, because it breaks 'atomization' of stuff in the
+ * object file by the linker. We need to emit this as a l label
+ * without .globl.
+ */
+#ifndef CONFIG_DARWIN_H
#ifdef ENABLE_LLVM
DECL_LLVM_PRIVATE (new) = 1;
#endif
+#endif
/* LLVM LOCAL end */
DECL_INITIAL (new) = ctor;
if (align > DECL_ALIGN (new))
More information about the llvm-commits
mailing list