On Wed, Apr 28, 2021 at 10:50 AM Richard Biener <rguent...@suse.de> wrote:
>
> This makes sure to fall into the delete_unreachable_blocks_update_callgraph
> handling to remove blocks becoming unreachable when removing EH edges
> by open-coding gimple_purge_dead_eh_edges.
>
> This fixes an ICE seen with gfortran.dg/gomp/pr88933.f90 when enhancing
> DSE.
>
> Bootstrap & regtest running on x86_64-unknown-linux-gnu.  Ok for
> trunk and branch(es)?

I sent v2 because in the end modifying the CFG during a dom walk seems
suspicious.  Other walkers record blocks to update in a bitmap and do
the update after the fact.

Richard.

> 2021-04-28  Richard Biener  <rguent...@suse.de>
>
>         PR ipa/100308
>         * ipa-prop.c (ipcp_modif_dom_walker::before_dom_children):
>         Open-code gimple_purge_dead_eh_edges, only removing the edge.
> ---
>  gcc/ipa-prop.c | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
> index 010c43f33e8..1f55eb5e247 100644
> --- a/gcc/ipa-prop.c
> +++ b/gcc/ipa-prop.c
> @@ -55,6 +55,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "options.h"
>  #include "symtab-clones.h"
>  #include "attr-fnspec.h"
> +#include "cfghooks.h"
>
>  /* Function summary where the parameter infos are actually stored. */
>  ipa_node_params_t *ipa_node_params_sum = NULL;
> @@ -5616,9 +5617,22 @@ ipcp_modif_dom_walker::before_dom_children 
> (basic_block bb)
>         }
>
>        *m_something_changed = true;
> -      if (maybe_clean_eh_stmt (stmt)
> -         && gimple_purge_dead_eh_edges (gimple_bb (stmt)))
> -       *m_cfg_changed = true;
> +      if (maybe_clean_eh_stmt (stmt))
> +       {
> +         /* Open-code gimple_purge_dead_eh_edges to not remove
> +            dominated blocks here which wouldn't correctly update
> +            the callgraph (PR100308).  */
> +         edge_iterator ei;
> +         edge e;
> +         for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei));)
> +           if (e->flags & EDGE_EH)
> +             {
> +               remove_edge (e);
> +               *m_cfg_changed = true;
> +             }
> +           else
> +             ei_next (&ei);
> +       }
>      }
>    return NULL;
>  }
> --
> 2.26.2

Reply via email to