[Bug tree-optimization/86489] ICE in gimple_phi_arg starting with r261682 when building 531.deepsjeng_r with FDO + LTO

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jul 12 12:16:00 GMT 2018


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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to kugan from comment #3)
> (In reply to Richard Biener from comment #2)
> >   gimple *phi = SSA_NAME_DEF_STMT (b_11);
> >   if (gimple_code (phi) != GIMPLE_PHI
> >       || (gimple_assign_lhs (and_stmt)
> >           != gimple_phi_arg_def (phi, loop_latch_edge (loop)->dest_idx)))
> >     return false;
> > 
> > this may fail if the PHI in question is not the correct one in which case
> > it may not have the argument at the latch dest_idx.  Try first verifying
> > that the loop latch destination is indeed gimple_bb (phi).
> 
> yes, thanks for spotting. I am testing the following patch:
> 
> diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
> index f6fa2f7..fbdf838 100644
> --- a/gcc/tree-ssa-loop-niter.c
> +++ b/gcc/tree-ssa-loop-niter.c
> @@ -2555,6 +2555,7 @@ number_of_iterations_popcount (loop_p loop, edge exit,
>     ... = PHI <b_5(2), b_6(3)>.  */
>    gimple *phi = SSA_NAME_DEF_STMT (b_11);
>    if (gimple_code (phi) != GIMPLE_PHI
> +      || (gimple_bb (phi) != loop_latch_edge (loop)->dest)
>        || (gimple_assign_lhs (and_stmt)
>           != gimple_phi_arg_def (phi, loop_latch_edge (loop)->dest_idx)))
>      return false;
> 
> is checking that there is argument at the latch dest_idx (argument count of
> PHI) is still necessary?

No, the number of edges determines that.  The above patch is OK if it
bootstraps/tests OK.

Richard.


More information about the Gcc-bugs mailing list