> -----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? Paulo Matos > Richard. >