On Fri, Apr 01, 2016 at 09:36:49AM +0200, Richard Biener wrote: > On Fri, Apr 1, 2016 at 6:54 AM, Segher Boessenkool > <seg...@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? :-) Cheers, Segher