[PATCH GCC]Remove support for -funsafe-loop-optimizations

Bin.Cheng amker.cheng@gmail.com
Mon Jul 18 07:55:00 GMT 2016


On Sat, Jul 16, 2016 at 6:28 PM, NightStrike <nightstrike@gmail.com> wrote:
> On Fri, Jul 15, 2016 at 1:07 PM, Bin Cheng <Bin.Cheng@arm.com> wrote:
>> Hi,
>> This patch removes support for -funsafe-loop-optimizations, as well as -Wunsafe-loop-optimizations.  By its name, this option does unsafe optimizations by assuming all loops must terminate and doesn't wrap.  Unfortunately, it's not as useful as expected because:
>> 1) Simply assuming loop must terminate isn't enough.  What we really want is to analyze scalar evolution and loop niter bound under such assumptions.  This option does nothing in this aspect.
>> 2) IIRC, this option generates bogus code for some common programs, that's why it's disabled by default even at Ofast level.
>>
>> After I sent patches handling possible infinite loops in both (scev/niter) analyzer and vectorizer, it's a natural step to remove such options in GCC.  This patch does so by deleting code for -funsafe-loop-optimizations, as well as -Wunsafe-loop-optimizations.  It also deletes the two now useless tests, while the option interface is preserved for backward compatibility purpose.
>
> There are a number of bugs opened against those options, including one
> that I just opened rather recently:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71769
>
> but some go back far, in this case 9 years:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34114
>
> If you are going to remove the options, you should address open bugs
> related to those options.
Hi,
Thanks for pointing me to these PRs, I will have a look at them.
IMHO, the old one reports weakness in loop niter analyzer, the issue
exists whether I remove unsafe-loop-optimization or not.  The new one
is a little bit trickier, I will put some comments on PR, and again,
the issue (if it is) is in niter analyzer which has nothing to do with
the option really.

Thanks,
bin



More information about the Gcc-patches mailing list