This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Prevent loops from being optimized away
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 1 Apr 2016 10:59:35 -0500
- Subject: Re: [PATCH] Prevent loops from being optimized away
- Authentication-results: sourceware.org; auth=none
- References: <9fc51a58cc354a934ff5a5e2b232dae520090e2b dot 1459485314 dot git dot segher at kernel dot crashing dot org> <CA+=Sn1niKHe6e_qQxEbrKAyOTZNHswcOYzGe04-CHxLHAvKkHQ at mail dot gmail dot com>
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