This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PR target/18910
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 2 Jan 2005 10:21:18 +0100
- Subject: PR target/18910
Hi,
the problem is loop trying to produce move of const expression
containing TLS reference. (the bug has been uncovered by change forcing
tree optimizers to believe that TLS references are constants and thus
loop optimizer on trees won't hoist it)
Bootstrapped/regtested i686-pc-gnu-linux
Honza
extern __thread void *foo [];
void
test1 (void)
{
int s;
for (s = 0; s < 2; ++s)
{
foo [s] = &foo[s];
}
}
2005-01-02 Jan Hubicka <jh@suse.cz>
PR target/18910
* i386.c (ix86_expand_move): Work harder to discover TLS.
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.766
diff -c -3 -p -r1.766 i386.c
*** config/i386/i386.c 28 Dec 2004 05:26:23 -0000 1.766
--- config/i386/i386.c 2 Jan 2005 00:11:53 -0000
*************** ix86_expand_move (enum machine_mode mode
*** 7472,7478 ****
op0 = operands[0];
op1 = operands[1];
! model = GET_CODE (op1) == SYMBOL_REF ? SYMBOL_REF_TLS_MODEL (op1) : 0;
if (model)
{
op1 = legitimize_tls_address (op1, model, true);
--- 7472,7484 ----
op0 = operands[0];
op1 = operands[1];
! if (GET_CODE (op1) == CONST && GET_CODE (XEXP (op1, 0)) == PLUS
! && GET_CODE (XEXP (XEXP (op1, 0), 0)) == SYMBOL_REF)
! model = SYMBOL_REF_TLS_MODEL (XEXP (XEXP (op1, 0), 0));
! else if (GET_CODE (op1) == SYMBOL_REF)
! model = SYMBOL_REF_TLS_MODEL (op1);
! else
! model = 0;
if (model)
{
op1 = legitimize_tls_address (op1, model, true);