https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102844

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org
             Status|ASSIGNED                    |NEW
           Priority|P3                          |P2
           Assignee|rguenth at gcc dot gnu.org         |unassigned at gcc dot 
gnu.org

--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #15)
> The following removes the premature optimization(?) using
> EDGE_NO_COPY_SRC_BLOCK
> in case the block contained a condition we could thread through.  That fixes
> the testcase.
> 
> diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
> index c3ea2d680d8..2005e30322b 100644
> --- a/gcc/tree-ssa-threadedge.c
> +++ b/gcc/tree-ssa-threadedge.c
> @@ -989,8 +989,11 @@ thread_around_empty_blocks (edge taken_edge,
>         return false;
>        bitmap_set_bit (visited, taken_edge->dest->index);
>  
> +      /* We may not use EDGE_NO_COPY_SRC_BLOCK since the condition
> +        might later be simplified to something needing a temporary
> +        SSA definition.  See PR102844.  */
>        jump_thread_edge *x
> -       = new jump_thread_edge (taken_edge, EDGE_NO_COPY_SRC_BLOCK);
> +       = new jump_thread_edge (taken_edge, EDGE_COPY_SRC_BLOCK);
>        path->safe_push (x);
>  
>        thread_around_empty_blocks (taken_edge,

OK, it isn't that easy - we overrun redirection_data::dup_blocks that way
causing random crashes later on.  So the change needs adjustments to how
we account thread_around_empty_blocks stuff, I couldn't find the code
that avoids this for non-empty blocks.

The issue is definitely latent everywhere even trunk as long as we keep
the DOM forward threader there.

Reply via email to