[PATCH] D28404: IRGen: Add optnone attribute on function during O0

Mehdi AMINI via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 10 12:08:27 PST 2017


mehdi_amini added a comment.

In https://reviews.llvm.org/D28404#641632, @probinson wrote:

> In https://reviews.llvm.org/D28404#641606, @mehdi_amini wrote:
>
> > If we want to support `-O0 -flto` and `optnone` it the way to convey this to the optimizer, I don't see the alternative.
>
>
> optsize != -Os (according to Chandler)
>  minsize != -Oz (according to Chandler)
>  optnone != -O0 (according to both me and Chandler)


Of course, but that's just an implementation limitation, mostly for historical reason I believe, not by design. That does not have to be set in stone and I'm giving you the direction with respect to LTO in particular here: these attributes should be able to behave the same way as the corresponding '-O' command line.

> optnone is not "the way to convey (-O0) to the optimizer."  Please get that misunderstanding out of your head.  Clang handles -O0 by creating a short, minimalist pipeline, and running everything through it.  Clang handles -O2 by creating a fuller optimization pipeline, and functions with 'optnone' skip many of the passes in the pipeline.

Don't get me wrong: I believe I have a very good understanding how the optimizer pipeline is setup and how the passes operates with respect to the attributes.
And it is because I understand the deficiencies (and how it is an issue with LTO) that I'm aligning all of this toward a consistent/coherent expected result for the users.

> These are architecturally different processes, you are not going to be able to make 'optnone' behave exactly like -O0 without major redesign of how the pipelines work.

I'd disagree about your estimation of "major". It's not gonna be tomorrow, sure, but it does not have to be. The most difficult part will be the inter procedural ones, but there are not that many.


https://reviews.llvm.org/D28404





More information about the cfe-commits mailing list