s390.c (s390_preferred_reload_class): Don't return ADDR_REGS for invalid symrefs in non-PIC code.

2014-01-15  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

	* config/s390/s390.c (s390_preferred_reload_class): Don't return
	ADDR_REGS for invalid symrefs in non-PIC code.

2014-01-15  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

	* gcc.c-torture/compile/pr59803.c: New testcase.

From-SVN: r206623
This commit is contained in:
Andreas Krebbel 2014-01-15 08:36:44 +00:00 committed by Andreas Krebbel
parent 2738b4c7e3
commit cb4b6d1706
4 changed files with 47 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2014-01-15 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config/s390/s390.c (s390_preferred_reload_class): Don't return
ADDR_REGS for invalid symrefs in non-PIC code.
2014-01-15 Jakub Jelinek <jakub@redhat.com>
PR other/58712

View File

@ -3148,15 +3148,22 @@ s390_preferred_reload_class (rtx op, reg_class_t rclass)
prefer ADDR_REGS. If 'class' is not a superset
of ADDR_REGS, e.g. FP_REGS, reject this reload. */
case CONST:
/* A larl operand with odd addend will get fixed via secondary
reload. So don't request it to be pushed into literal
pool. */
/* Symrefs cannot be pushed into the literal pool with -fPIC
so we *MUST NOT* return NO_REGS for these cases
(s390_cannot_force_const_mem will return true).
On the other hand we MUST return NO_REGS for symrefs with
invalid addend which might have been pushed to the literal
pool (no -fPIC). Usually we would expect them to be
handled via secondary reload but this does not happen if
they are used as literal pool slot replacement in reload
inheritance (see emit_input_reload_insns). */
if (TARGET_CPU_ZARCH
&& GET_CODE (XEXP (op, 0)) == PLUS
&& GET_CODE (XEXP (XEXP(op, 0), 0)) == SYMBOL_REF
&& GET_CODE (XEXP (XEXP(op, 0), 1)) == CONST_INT)
{
if (reg_class_subset_p (ADDR_REGS, rclass))
if (flag_pic && reg_class_subset_p (ADDR_REGS, rclass))
return ADDR_REGS;
else
return NO_REGS;

View File

@ -1,3 +1,7 @@
2014-01-15 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* gcc.c-torture/compile/pr59803.c: New testcase.
2014-01-15 Jakub Jelinek <jakub@redhat.com>
PR c/58943

View File

@ -0,0 +1,27 @@
/* PR target/59803 */
extern void baz (void) __attribute__ ((__noreturn__));
struct A { int g, h; };
extern struct A a;
struct B { unsigned char i, j, k, l, m; };
int c, d, e;
static int f;
void
foo (void)
{
f = 1;
}
void
bar (struct B *x)
{
x->i = e;
x->k = c;
x->l = d;
x->j = a.h;
x->m = f;
if (x->i != e) baz ();
if (x->k != c) baz ();
if (x->j != a.h) baz ();
}