Commit 37e27de4 by Richard Biener

middle-end/93273 - fix sinking clobbers across backedges

The previous work to fix PR93199 didn't take into account backedges
when defering insertion.  The following simply avoids to defer in that
case since we know we'll not take secondary opportunities there.

2020-01-15  Richard Biener  <rguenther@suse.de>

        PR middle-end/93273
        * tree-eh.c (sink_clobbers): If we already visited the destination
        block do not defer insertion.
        (pass_lower_eh_dispatch::execute): Maintain BB_VISITED for
        the purpose of defered insertion.

	* g++.dg/torture/pr93273.C: New testcase.
parent a52d9321
2020-01-15 Richard Biener <rguenther@suse.de>
PR middle-end/93273
* tree-eh.c (sink_clobbers): If we already visited the destination
block do not defer insertion.
(pass_lower_eh_dispatch::execute): Maintain BB_VISITED for
the purpose of defered insertion.
2020-01-15 Jakub Jelinek <jakub@redhat.com> 2020-01-15 Jakub Jelinek <jakub@redhat.com>
* BASE-VER: Bump to 10.0.1. * BASE-VER: Bump to 10.0.1.
......
2020-01-15 Richard Biener <rguenther@suse.de>
PR middle-end/93273
* g++.dg/torture/pr93273.C: New testcase.
2020-01-15 Richard Sandiford <richard.sandiford@arm.com> 2020-01-15 Richard Sandiford <richard.sandiford@arm.com>
PR tree-optimization/93247 PR tree-optimization/93247
......
// { dg-do compile }
void _setjmp(void *);
struct S { ~S(); };
void * (* fn)();
void f();
void g()
{
S s;
_setjmp(fn());
[]{ f(); }();
}
...@@ -3622,7 +3622,7 @@ sink_clobbers (basic_block bb, ...@@ -3622,7 +3622,7 @@ sink_clobbers (basic_block bb,
gimple *first_sunk = NULL; gimple *first_sunk = NULL;
gimple *last_sunk = NULL; gimple *last_sunk = NULL;
if (sunk) if (sunk && !(succbb->flags & BB_VISITED))
dgsi = gsi_start (sunk[succbb->index]); dgsi = gsi_start (sunk[succbb->index]);
else else
dgsi = gsi_after_labels (succbb); dgsi = gsi_after_labels (succbb);
...@@ -3910,6 +3910,7 @@ pass_lower_eh_dispatch::execute (function *fun) ...@@ -3910,6 +3910,7 @@ pass_lower_eh_dispatch::execute (function *fun)
else if (!any_resx_to_process) else if (!any_resx_to_process)
sink_clobbers (bb, NULL, &any_resx_to_process); sink_clobbers (bb, NULL, &any_resx_to_process);
} }
bb->flags &= ~BB_VISITED;
} }
if (redirected) if (redirected)
{ {
...@@ -3940,6 +3941,7 @@ pass_lower_eh_dispatch::execute (function *fun) ...@@ -3940,6 +3941,7 @@ pass_lower_eh_dispatch::execute (function *fun)
gsi_insert_seq_before (&gsi, sunk[bb->index], GSI_NEW_STMT); gsi_insert_seq_before (&gsi, sunk[bb->index], GSI_NEW_STMT);
sunk[bb->index] = NULL; sunk[bb->index] = NULL;
} }
bb->flags |= BB_VISITED;
} }
free (rpo); free (rpo);
free (sunk); free (sunk);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment