re PR tree-optimization/47355 (ICE: verify_ssa failed with -O2 -fipa-cp-clone)

PR tree-optimization/47355
	* tree-eh.c (cleanup_empty_eh_merge_phis): Give up if
	NOP has non-debug uses beyond PHIs in new_bb.

	* g++.dg/opt/pr47355.C: New test.

From-SVN: r169094
This commit is contained in:
Jakub Jelinek 2011-01-21 16:15:40 +01:00 committed by Jakub Jelinek
parent 1c7d0b34dc
commit 3ffe07e16c
4 changed files with 64 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2011-01-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/47355
* tree-eh.c (cleanup_empty_eh_merge_phis): Give up if
NOP has non-debug uses beyond PHIs in new_bb.
2011-01-21 Alexandre Oliva <aoliva@redhat.com>
PR debug/47106

View File

@ -1,3 +1,8 @@
2011-01-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/47355
* g++.dg/opt/pr47355.C: New test.
2011-01-21 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/pr47392.c: Make test non-static instead of

View File

@ -0,0 +1,39 @@
// PR tree-optimization/47355
// { dg-do compile }
// { dg-options "-O -fipa-cp -fipa-cp-clone" }
struct T
{
T ();
void *p;
~T ();
};
void foo (T *i);
T *bar ();
void baz (T *);
struct V
{
long q;
T *r;
~V ()
{
while (q)
{
foo (r);
++r;
--q;
}
baz (r);
}
};
void
foo ()
{
V v;
T t;
v.r = bar ();
}

View File

@ -3552,6 +3552,20 @@ cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_bb,
/* If we did find the corresponding PHI, copy those inputs. */
if (ophi)
{
/* If NOP is used somewhere else beyond phis in new_bb, give up. */
if (!has_single_use (nop))
{
imm_use_iterator imm_iter;
use_operand_p use_p;
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, nop)
{
if (!gimple_debug_bind_p (USE_STMT (use_p))
&& (gimple_code (USE_STMT (use_p)) != GIMPLE_PHI
|| gimple_bb (USE_STMT (use_p)) != new_bb))
goto fail;
}
}
bitmap_set_bit (ophi_handled, SSA_NAME_VERSION (nop));
FOR_EACH_EDGE (e, ei, old_bb->preds)
{