[PATCH][2/2] Sanity check removed loops

Jeff Law law@redhat.com
Fri Sep 5 16:48:00 GMT 2014


On 09/05/14 04:00, Richard Biener wrote:
>
> The following patch adds sanity checking for loops removed
> via mark_loop_for_removal or fix_loop_structure to check
> whether they reappear in the same place.
>
> The simplest case is where the loop header stays the same
> and we definitely should avoid all these cases.
>
> The other case is where the old header becomes part of
> a newly discovered loop.  That happens when you rotate
> a loop for example.
>
> The interesting bits of this are the new former_header field
> in struct loop which holds onto the old header basic-block
> so that even when it gets discarded its memory will not be
> reused.  For the sanity checking we can then verify if
> it is still a basic-block in the current function.
>
> In theory we might be able to "autodetect" some loop
> rotation cases as well as "restore" bogusly removed loops.
> I'll see what the best solution is here after I (or somebody
> else) has some testcases to look at.
>
> Bootstrap and regtest running on x86_64-unknown-linux-gnu.
>
> Richard.
>
> 2014-09-05  Richard Biener  <rguenther@suse.de>
>
> 	* cfgloop.c (mark_loop_for_removal): Record former header
> 	when ENABLE_CHECKING.
> 	* cfgloop.h (strut loop): Add former_header member when
> 	ENABLE_CHECKING.
> 	* loop-init.c (fix_loop_structure): Sanity check loops
> 	marked for removal if they re-appeared.
Thanks for taking care of this....

Jeff



More information about the Gcc-patches mailing list