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
+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.
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
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))
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;