[ree] PR rtl-optimization/78038: Handle global register dataflow definitions in ree

PR rtl-optimization/78038
	* ree.c (get_defs): Return NULL if a defining insn for REG cannot
	be deduced to set REG through the RTL structure.
	(make_defs_and_copies_lists): Return false on a failing get_defs call.

	* gcc.target/aarch64/pr78038.c: New test.

From-SVN: r241395
This commit is contained in:
Kyrylo Tkachov 2016-10-21 07:55:30 +00:00 committed by Kyrylo Tkachov
parent a20d03c882
commit 0d47cee6c4
4 changed files with 49 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2016-10-21 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR rtl-optimization/78038
* ree.c (get_defs): Return NULL if a defining insn for REG cannot
be deduced to set REG through the RTL structure.
(make_defs_and_copies_lists): Return false on a failing get_defs call.
2016-10-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/78051

View File

@ -482,6 +482,14 @@ get_defs (rtx_insn *insn, rtx reg, vec<rtx_insn *> *dest)
return NULL;
if (DF_REF_INSN_INFO (ref_link->ref) == NULL)
return NULL;
/* As global regs are assumed to be defined at each function call
dataflow can report a call_insn as being a definition of REG.
But we can't do anything with that in this pass so proceed only
if the instruction really sets REG in a way that can be deduced
from the RTL structure. */
if (global_regs[REGNO (reg)]
&& !set_of (reg, DF_REF_INSN (ref_link->ref)))
return NULL;
}
if (dest)
@ -580,7 +588,7 @@ make_defs_and_copies_lists (rtx_insn *extend_insn, const_rtx set_pat,
/* Initialize the work list. */
if (!get_defs (extend_insn, src_reg, &state->work_list))
gcc_unreachable ();
return false;
is_insn_visited = XCNEWVEC (bool, max_insn_uid);

View File

@ -1,3 +1,8 @@
2016-10-21 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR rtl-optimization/78038
* gcc.target/aarch64/pr78038.c: New test.
2016-10-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/78051

View File

@ -0,0 +1,28 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* PR rtl-optimization/78038.
Make sure ree can gracefully handle extensions of the global
variable register after a call. */
typedef void (*test_fptr_t) (void);
void
test_f (void)
{
}
test_fptr_t test_fptr = test_f;
struct test2_s
{
int f;
};
register struct test2_s *g __asm__("x28");
void
do_something ()
{
test_fptr ();
struct test2_s *p1 = 0;
*p1 = *g;
}