On Wed, Jan 03, 2018 at 02:07:36PM +0100, Martin Liška wrote:
> 2018-01-03 Martin Liska <[email protected]>
>
> PR tree-optimization/83593
> * tree-ssa-strlen.c (strlen_check_and_optimize_stmt): Clean-up
> EH gimple statements.
> (strlen_dom_walker::before_dom_children): Call
> gimple_purge_dead_eh_edges.
> (pass_strlen::execute): Return TODO_cleanup_cfg if needed.
The ChangeLog entry doesn't contain all the changes, like:
> @@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
> #include "gimple-iterator.h"
> #include "gimplify-me.h"
> #include "expr.h"
> +#include "tree-cfg.h"
> #include "tree-dfa.h"
> #include "domwalk.h"
> #include "tree-ssa-alias.h"
the above one.
> static bool
> -strlen_check_and_optimize_stmt (gimple_stmt_iterator *gsi)
> +strlen_check_and_optimize_stmt (gimple_stmt_iterator *gsi, bool *cleanup_eh)
This one (i.e. addition of a new argument).
> @@ -3318,10 +3337,16 @@ do_invalidate (basic_block dombb, gimple *phi, bitmap
> visited, int *count)
> class strlen_dom_walker : public dom_walker
> {
> public:
> - strlen_dom_walker (cdi_direction direction) : dom_walker (direction) {}
> + strlen_dom_walker (cdi_direction direction)
> + : dom_walker (direction), m_cleanup_cfg (false)
> + {}
This one.
>
> virtual edge before_dom_children (basic_block);
> virtual void after_dom_children (basic_block);
> +
> + /* Flag that will trigger TODO_cleanup_cfg to be returned in strlen
> + execute function. */
> + bool m_cleanup_cfg;
This one too.
> + bool cleanup_eh = false;
> +
> /* Attempt to optimize individual statements. */
> for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
> - if (strlen_check_and_optimize_stmt (&gsi))
> + if (strlen_check_and_optimize_stmt (&gsi, &cleanup_eh))
> gsi_next (&gsi);
And the fact that strlen_check_and_optimize_stmt caller has been adjusted.
>
> + if (cleanup_eh)
> + {
> + gimple_purge_dead_eh_edges (bb);
> + m_cleanup_cfg = true;
> + }
This should be
if (cleanup_eh && gimple_purge_dead_eh_edges (bb))
m_cleanup_cfg = true;
Ok with that change and updated ChangeLog entry if it passes
bootstrap/regtest.
Jakub