[PATCH] Prevent loops from being optimized away

Segher Boessenkool segher@kernel.crashing.org
Fri Apr 1 16:00:00 GMT 2016


On Fri, Apr 01, 2016 at 08:32:28AM -0700, Andrew Pinski wrote:
> On Thu, Mar 31, 2016 at 9:54 PM, 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.
> 
> The Linux kernel has a nice workaround for this case, at least for the
> divide case.

I know, I wrote that code :-)  It has a slightly different purpose (and
semantics) though: it makes _sure_ that "inside, we know what is going on"
does not hold (that's what "+rm" does).  But yes, it is playing a similar
game.


Segher



More information about the Gcc-patches mailing list