This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Prevent loops from being optimized away


On April 1, 2016 5:18:10 PM GMT+02:00, Segher Boessenkool <segher@kernel.crashing.org> wrote:
>On Fri, Apr 01, 2016 at 09:36:49AM +0200, Richard Biener wrote:
>> On Fri, Apr 1, 2016 at 6:54 AM, Segher Boessenkool
>> <segher@kernel.crashing.org> wrote:
>> > Sometimes people write loops that they do not want optimized away,
>even
>> > when the compiler can replace those loops by a simple expression
>(or
>> > nothing).  For such people, this patch adds a compiler option.
>> >
>> > Bootstrapped on powerpc64-linux; regression check still in progress
>> > (with Init(1) to actually test anything).
>> 
>> -fno-tree-scev-cprop?  -O0?
>
>There are other cases where GCC can delete loops, for example cddce1.
>
>> A new compiler option for this is complete overkill (and it's
>implementation
>> is gross ;)).  Semantics are also unclear, your patch would only make
>sure
>> to preserve an empty loop with the asm in the latch, it wouldn't
>disallow
>> replacing the overall effect with a computation.
>
>That's right, and the loop can even still be unrolled, even fully
>unrolled (which is good, not only should we not desert the loop but
>we also shouldn't run around so much).
>
>> Your patch would also miss a few testcases.
>
>It already makes ~2000 (mainly vectorisation) testcases fail, is that
>not enough coverage?  :-)

For an April 1st joke yes, otherwise no :)

Richard.

>Cheers,
>
>
>Segher



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]