[LLVMdev] Disabling certain optimizations at -O1?

Renato Golin renato.golin at linaro.org
Sun Dec 1 04:38:43 PST 2013


On 1 December 2013 10:44, Evgeniy Stepanov <eugeni.stepanov at gmail.com> wrote:
> Could we move this setting to function attributes?

I think this is a good idea.


> This would let us support __attribute__((optimize())) in the future,
> which is currently ignored.

I'm adding #pragma vectorize enable which does more or less the same
thing as __attribute__(optimize(loop-vectorize)) or #pragma GCC
optimize loop-vectorize, but on a loop/block level. (Note to self, I
could do that on a function level, too).

For this change, I'll have to always add the vectorizer pass, but with
a flag on constructor specifying if I want it to always run, or only
with a pragma. The same thing can be done with the #pragma GCC
optimize (which we should support as is, but call #pragma optimize and
ask GCC to support both).

Same thing with optimization levels (#pragma optimize 3), we can embed
the knowledge of the flags and optimization level, so then when we
pass them to the passes, we already know what we want to run without
having to change in many places.

In the end, populateModulePassManager() should be about building the
flags table and (almost) unconditionally adding all passes with the
respective flags.

cheers,
--renato



More information about the llvm-dev mailing list