This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: remove useless edge split in copy_loop_headers
- From: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- To: Zhouyi Zhou <zhouyi04 at ios dot cn>
- Cc: gcc-patches at gcc dot gnu dot org, rguenth at gcc dot gnu dot org
- Date: Fri, 30 May 2008 16:51:48 +0200
- Subject: Re: remove useless edge split in copy_loop_headers
- References: <20080519091038.0fe496c8.zhouyi04@ios.cn>
Hi,
> The function copy_loop_headers after duplicate the region for a loop,
>
> 234 }
> 235 }
> 236
> 237 /* Ensure that the latch and the preheader is simple (we know that they
> 238 are not now, since there was the loop exit condition. */
> 239 split_edge (loop_preheader_edge (loop));
> 240 split_edge (loop_latch_edge (loop));
> 241 }
> 242
> 243 free (bbs);
>
>
> In fact, the statements in line 239 and 240 are useless because there will
> be no code motion optimizing (for example loop invariant movement) related to
> that splitting in this pass, and the edges created by above statements are
> removed by cfg cleanup in execute_todo that follows.
however, as the comment suggests, they are necessary to ensure that the
loop latch and the loop preheader have exactly one predecessor, which
are the invariants about the loop structure that we preserve.
While at the moment it indeed is not strictly necessary to enforce these
invariants at this particular point (as we do not optimize the loops
further), the code should be left there as it is; not doing so would
cause verify_loops fail after the transformation, which would make
debugging more difficult. Also, sometime in future we may decide to do
some more complicated processing after/during loop header copying.
Do you have some reason why you want to have these statements removed
(i.e., do you see them increasing compile time/memory consumption)?
Zdenek