[cfe-dev] [RFC] A proposal for #pragma optnone

Renato Golin renato.golin at linaro.org
Tue Apr 29 04:07:22 PDT 2014


On 28 April 2014 23:30, Robinson, Paul
<Paul_Robinson at playstation.sony.com> wrote:
> We stayed away from the existing pragmas because what we can (and
> want) to do is much less than what the existing pragmas do (in
> other compilers).

I think here's where you're mistaken. It's not. As Chandler said,
there are only two valid cases: disable all opts or force higher opt.
Both can be used for either debugging or working around miscompiles.

I've done some tests on GCC with pragmas from 0 to 3 and -O0 to -O3
and the results are inconsistent. The generated code is different for
"pragma N" on almost all -O levels, so no one will expect consistency.


>  If people think it's better to use exactly the
> existing syntax, and fail to support all of what they do, that's
> okay with us (if I'm remembering the internal discussions correctly).

That's what I expected, yes.

The same reason why we didn't invent "#pragma vectorize ...", because
there were others (even if disparate) that did the same thing. The
consensus was to implement each specific case from different bundles
(OMP, Cilk, etc) instead of creating a list of new pragmas, and I
think this is what has to be done in this case, too.

General rule of new pragmas: don't.

General rule of existing pragmas: mirroring attributes or annotation
with the same semantics.

cheers,
--renato



More information about the cfe-dev mailing list