Add missing check in stmt_local_def for tail-merge.

2013-10-22  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/58805
	* tree-ssa-tail-merge.c (stmt_local_def): Add gimple_vdef check.

	* gcc.dg/pr58805.c: New test.

From-SVN: r203973
This commit is contained in:
Tom de Vries 2013-10-23 13:26:45 +00:00 committed by Tom de Vries
parent 7abed77964
commit a63b68b2f2
4 changed files with 36 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2013-10-23 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/58805
* tree-ssa-tail-merge.c (stmt_local_def): Add gimple_vdef check.
2013-10-23 Jakub Jelinek <jakub@redhat.com>
* tree-vect-patterns.c (vect_recog_divmod_pattern): Optimize

View File

@ -1,3 +1,8 @@
2013-10-23 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/58805
* gcc.dg/pr58805.c: New test.
2013-10-23 Jakub Jelinek <jakub@redhat.com>
* gcc.target/i386/vect-div-1.c: New test.

View File

@ -0,0 +1,24 @@
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */
/* Type that matches the 'p' constraint. */
#define TYPE void *
static inline
void bar (TYPE *r)
{
TYPE t;
__asm__ ("" : "=&p" (t), "=p" (*r));
}
void
foo (int n, TYPE *x, TYPE *y)
{
if (n == 0)
bar (x);
else
bar (y);
}
/* { dg-final { scan-tree-dump-times "__asm__" 2 "pre"} } */
/* { dg-final { cleanup-tree-dump "pre" } } */

View File

@ -304,7 +304,8 @@ stmt_local_def (gimple stmt)
tree val;
def_operand_p def_p;
if (gimple_has_side_effects (stmt))
if (gimple_has_side_effects (stmt)
|| gimple_vdef (stmt) != NULL_TREE)
return false;
def_p = SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF);