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

--- Comment #3 from Andrey Belevantsev <abel at gcc dot gnu.org> ---
(In reply to Andrey Belevantsev from comment #2)
> We're not somehow updating liveness information at all times when we change
> control flow.  E.g. we do update liveness in sel_split_edge, but not in
> sel_redirect_edge_and_branch{,force} hooks, when we're making a new jump and
> resetting liveness on the bb it ended up in.  This leaves us with the
> unknown lv set, and later breaks when we're computing liveness from the
> other region and come to this block, as we're assuming that other regions
> always have correct liveness.
> 
> Fixed with the below patch but I'm not completely sure it fully makes sense
> -- Alexander, thoughts?
> 
> diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
> index 85ff5bd3eb4..c399c1117a3 100644
> --- a/gcc/sel-sched-ir.c
> +++ b/gcc/sel-sched-ir.c
> @@ -5642,6 +5642,8 @@ sel_redirect_edge_and_branch_force (edge e,
> basic_block to)
>                            recompute_dominator (CDI_DOMINATORS, to));
>    set_immediate_dominator (CDI_DOMINATORS, orig_dest,
>                            recompute_dominator (CDI_DOMINATORS, orig_dest));
> +  if (jump == sel_bb_head (BLOCK_FOR_INSN (jump)))
> +    compute_live (jump);
>  }
> 
>  /* A wrapper for redirect_edge_and_branch.  Return TRUE if blocks connected
> by
> @@ -5702,6 +5704,8 @@ sel_redirect_edge_and_branch (edge e, basic_block to)
>        set_immediate_dominator (CDI_DOMINATORS, orig_dest,
>                                 recompute_dominator (CDI_DOMINATORS,
> orig_dest));
>      }
> +  if (jump == sel_bb_head (BLOCK_FOR_INSN (jump)))
> +    compute_live (jump);
>    return recompute_toporder_p;
>  }

It looks like the routine that creates recovery blocks also updates liveness,
so I'm now more confident with the patch, but I'd still like to hear
Alexander's opinion.  Of course, it should really be sel_bb_head_p (jump)
instead of that clumsy condition I've wrote.

Reply via email to