From: Tom de Vries Date: Mon, 8 Jun 2015 16:59:31 +0000 (+0000) Subject: Handle -fipa-ra in reload_combine X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=97ded4cd2072029ac4d6d86e5b6eb5225961a27d;p=gcc.git Handle -fipa-ra in reload_combine 2015-06-08 Tom de Vries PR rtl-optimization/66444 * postreload.c (reload_combine): Use get_call_reg_set_usage instead of call_used_regs. * gcc.dg/pr66444.c: New test. From-SVN: r224240 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55b5a834559..e3b98f30249 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-06-08 Tom de Vries + + PR rtl-optimization/66444 + * postreload.c (reload_combine): Use get_call_reg_set_usage instead of + call_used_regs. + 2015-06-08 Richard Biener PR tree-optimization/66422 diff --git a/gcc/postreload.c b/gcc/postreload.c index 7ecca15f759..1cc7b143b31 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -1352,9 +1352,12 @@ reload_combine (void) if (CALL_P (insn)) { rtx link; + HARD_REG_SET used_regs; + + get_call_reg_set_usage (insn, &used_regs, call_used_reg_set); for (r = 0; r < FIRST_PSEUDO_REGISTER; r++) - if (call_used_regs[r]) + if (TEST_HARD_REG_BIT (used_regs, r)) { reg_state[r].use_index = RELOAD_COMBINE_MAX_USES; reg_state[r].store_ruid = reload_combine_ruid; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ffef82e3ff2..1209664293c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-06-08 Tom de Vries + + PR rtl-optimization/66444 + * gcc.dg/pr66444.c: New test. + 2015-06-08 Steven G. Kargl PR fortran/66245 diff --git a/gcc/testsuite/gcc.dg/pr66444.c b/gcc/testsuite/gcc.dg/pr66444.c new file mode 100644 index 00000000000..3f92a5c779b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr66444.c @@ -0,0 +1,79 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fipa-ra" } */ + +extern void abort (void); + +#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__) +#define ADD_SUFFIX(a) a ## ULL +#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__) +#define ADD_SUFFIX(a) a ## UL +#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__) +#define ADD_SUFFIX(a) a ## U +#else +#error Add target support here +#endif + +#if __SIZEOF_POINTER__ <= 4 +/* Use a 16 bit pointer to have a valid pointer for 16-bit to 31-bit pointer + architectures. Using sizeof, we cannot distinguish between 31-bit and 32-bit + pointer types, so we also handle the 32-bit pointer type case here. */ +#define CONST_PTR ADD_SUFFIX (0x800) +#else +/* For x86_64 -m64, the problem reproduces with this 32-bit CONST_PTR, but not + with a 2-power below it. */ +#define CONST_PTR ADD_SUFFIX (0x80000000) +#endif + +int __attribute__((noinline, noclone)) +bar (void) +{ + return 1; +} + +struct S +{ + unsigned long p, q, r; + void *v; +}; + +struct S *s1; +struct S *s2; + +void __attribute__((noinline, noclone)) +fn2 (struct S *x) +{ + s2 = x; +} + +__attribute__((noinline, noclone)) void * +fn1 (struct S *x) +{ + /* Just a statement to make it a non-const function. */ + s1 = x; + + return (void *)0; +} + +int __attribute__((noinline, noclone)) +baz (void) +{ + struct S *x = (struct S *) CONST_PTR; + + x += bar (); + + fn1 (x); + fn2 (x); + + return 0; +} + +int +main (void) +{ + baz (); + + if (s2 != (((struct S *) CONST_PTR) + 1)) + abort (); + + return 0; +}