re PR middle-end/36753 (Forward propagation interacts badly with global register variable)

gcc:
2008-07-17  Paolo Bonzini  <bonzini@gnu.org>

	PR rtl-optimization/36753
	* fwprop.c (use_killed_between): Don't shortcut
	single-definition global registers.

gcc/testsuite:
2008-07-17  Paolo Bonzini  <bonzini@gnu.org>

	PR rtl-optimization/36753
	* gcc.target/i386/pr36753.c: New.

From-SVN: r137913
This commit is contained in:
Paolo Bonzini 2008-07-17 09:07:31 +00:00 committed by Paolo Bonzini
parent 8a63781b05
commit b08c51086f
4 changed files with 49 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2008-07-17 Paolo Bonzini <bonzini@gnu.org>
PR rtl-optimization/36753
* fwprop.c (use_killed_between): Don't shortcut
single-definition global registers.
2008-07-16 Jan Hubicka <jh@suse.cz>
* cgraph.h (varpool_empty_needed_queue): Declare.

View File

@ -527,10 +527,15 @@ use_killed_between (struct df_ref *use, rtx def_insn, rtx target_insn)
return true;
/* Check if the reg in USE has only one definition. We already
know that this definition reaches use, or we wouldn't be here. */
know that this definition reaches use, or we wouldn't be here.
However, this is invalid for hard registers because if they are
live at the beginning of the function it does not mean that we
have an uninitialized access. */
regno = DF_REF_REGNO (use);
def = DF_REG_DEF_CHAIN (regno);
if (def && (def->next_reg == NULL))
if (def
&& def->next_reg == NULL
&& regno >= FIRST_PSEUDO_REGISTER)
return false;
/* Check locally if we are in the same basic block. */

View File

@ -1,3 +1,8 @@
2008-07-17 Paolo Bonzini <bonzini@gnu.org>
PR rtl-optimization/36753
* gcc.target/i386/pr36753.c: New.
2008-07-17 Tobias Burnus <burnus@net-b.de>
PR fortran/36825

View File

@ -0,0 +1,31 @@
/* { dg-options "-O2" } */
/* { dg-do run } */
#if defined __i386__
#define REG "edi"
#else
#define REG "r14"
#endif
register unsigned long *ds asm(REG);
extern void abort (void);
__attribute__ ((noinline)) void
test (void)
{
*++ds = 31337;
}
int
main ()
{
unsigned long stack[2];
stack[0] = 0;
stack[1] = 0;
ds = stack;
test ();
if (ds != stack + 1 || *ds != 31337)
abort ();
return 0;
}