> -----Original Message----- > From: Richard Biener [mailto:richard.guent...@gmail.com] > Sent: 13 March 2014 18:46 > To: Paulo Matos > Cc: gcc@gcc.gnu.org > Subject: RE: dom requires PROP_loops > > On March 13, 2014 5:00:53 PM CET, Paulo Matos <pma...@broadcom.com> wrote: > >> -----Original Message----- > >> From: Richard Biener [mailto:richard.guent...@gmail.com] > >> Sent: 13 March 2014 13:24 > >> To: Paulo Matos > >> Cc: gcc@gcc.gnu.org > >> Subject: Re: dom requires PROP_loops > >> > >> > >> Probably RTL cfgcleaup needs the same treatment as GIMPLE cfgcleanup > >> then - allow removal if loop properties allows it. > >> > > > >In both cfgcleanup.c and tree-cfgcleanup.c I can see code that protects > >loop latches, but I see no code that allows removal of latch if > >property allows it. > >From what you say I would expect this would already be implemented in > >tree-cfgcleanup.c, however what actually happens is that since > >current_loops is non-null (PROP_loops is not destroyed in tree > >loopdone), tree-cfgcleanup call chain ends up calling > >cleanup_tree_cfg_bb on the bb loop latch and tree_forwarder_block_p > >returns false for bb because of the following code thereby not removing > >the latch: > > if (current_loops) > > { > > basic_block dest; > > /* Protect loop latches, headers and preheaders. */ > > if (bb->loop_father->header == bb) > > return false; > > dest = EDGE_SUCC (bb, 0)->dest; > > > > if (dest->loop_father->header == dest) > > return false; > > } > > > >Why do we need to protect the latch? > > You are looking at old sources. >
That's correct. I was looking at 4.8. Let me take a look at what trunk is doing... :) > Richard. > > >Paulo Matos > > > >> Richard. > >> >