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

H.J. Lu hjl.tools@gmail.com
Fri Sep 5 18:02:00 GMT 2014


On Fri, Sep 5, 2014 at 3:00 AM, Richard Biener <rguenther@suse.de> 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.
>

I think it caused:

FAIL: g++.dg/torture/pr57140.C   -O3 -fomit-frame-pointer  (internal
compiler error)
FAIL: g++.dg/torture/pr57140.C   -O3 -fomit-frame-pointer  (test for
excess errors)
FAIL: g++.dg/torture/pr57140.C   -O3 -fomit-frame-pointer
-funroll-loops  (internal compiler error)
FAIL: g++.dg/torture/pr57140.C   -O3 -fomit-frame-pointer
-funroll-loops  (test for excess errors)
FAIL: g++.dg/torture/pr57140.C   -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  (internal compiler error)
FAIL: g++.dg/torture/pr57140.C   -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  (test for excess errors)
FAIL: g++.dg/torture/pr57140.C   -O3 -g  (internal compiler error)
FAIL: g++.dg/torture/pr57140.C   -O3 -g  (test for excess errors)

on x86.

-- 
H.J.



More information about the Gcc-patches mailing list