https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116835
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=91812
--- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #14)
> From
> https://inbox.sourceware.org/gcc-patches/
> CAFiYyc2LbQDLD=ukntp5yvauttyndnlm9vv-13uge2yp+wg...@mail.gmail.com/ :
>
> ```
> We need to constrain the load to be in the same or a subloop (use
> flow_loop_nested_p,
> not loop depth) or in the same BB when either the load or the PHI is
> in an irreducible region.
>
> >
> > + /* Only replace loads in blocks are in the same loop
> > + are inside an deeper loop. This is to make sure not
> > + to prop back into the loop. */
> > + if (bb_loop_depth (gimple_bb (use_stmt)) < bb_loop_depth (bb))
> > + continue;
> > +
>
> So something like
>
> /* Amend the post-dominance check for SSA cycles, we need to
> make sure each PHI result value is dereferenced. */
> if (!(gimple_bb (use_stmt) == bb
> || (!(bb->flags & BB_IRREDUCIBLE_LOOP)
> && !(gimple_bb (use_stmt)->flags & BB_IRREDUCIBLE_LOOP)
> && (bb->loop_father == gimple_bb (use_stmt)->loop_father
> || flow_loop_nested_p (bb->loop_father, gimple_bb
> (use_stmt)->loop_father)))))
> continue;
> ```
Oh this came up in PR 91812 comment #6 too.
Of course we have loop info now always :).