[-fcompare-debug] skip more debug stmts in cleanup_empty_eh

Various Ada RTS files failed -fcompare-debug compilation because debug
stmts prevented EH cleanups from taking place.  Adjusting
cleanup_empty_eh to skip them fixes it.

for  gcc/ChangeLog

	* gimple-iterator.h (gsi_one_nondebug_before_end_p): New.
	* tree-eh.c (cleanup_empty_eh): Skip more debug stmts.

From-SVN: r244088
This commit is contained in:
Alexandre Oliva 2017-01-05 01:46:14 +00:00 committed by Alexandre Oliva
parent 692216906b
commit 556655048b
3 changed files with 23 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2017-01-04 Alexandre Oliva <aoliva@redhat.com>
* gimple-iterator.h (gsi_one_nondebug_before_end_p): New.
* tree-eh.c (cleanup_empty_eh): Skip more debug stmts.
2017-01-04 Alexandre Oliva <aoliva@redhat.com>
* multiple_target.c (create_dispatcher_calls): Init e_next.

View file

@ -305,6 +305,20 @@ gsi_last_nondebug_bb (basic_block bb)
return i;
}
/* Return true if I is followed only by debug statements in its
sequence. */
static inline bool
gsi_one_nondebug_before_end_p (gimple_stmt_iterator i)
{
if (gsi_one_before_end_p (i))
return true;
if (gsi_end_p (i))
return false;
gsi_next_nondebug (&i);
return gsi_end_p (i);
}
/* Iterates I statement iterator to the next non-virtual statement. */
static inline void

View file

@ -4382,7 +4382,8 @@ cleanup_empty_eh (eh_landing_pad lp)
return false;
}
resx = last_stmt (bb);
gsi = gsi_last_nondebug_bb (bb);
resx = gsi_stmt (gsi);
if (resx && is_gimple_resx (resx))
{
if (stmt_can_throw_external (resx))
@ -4416,12 +4417,12 @@ cleanup_empty_eh (eh_landing_pad lp)
resx = gsi_stmt (gsi);
if (!e_out && gimple_call_builtin_p (resx, BUILT_IN_STACK_RESTORE))
{
gsi_next (&gsi);
gsi_next_nondebug (&gsi);
resx = gsi_stmt (gsi);
}
if (!is_gimple_resx (resx))
return ret;
gcc_assert (gsi_one_before_end_p (gsi));
gcc_assert (gsi_one_nondebug_before_end_p (gsi));
/* Determine if there are non-EH edges, or resx edges into the handler. */
has_non_eh_pred = false;