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

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 10 11:45:20 PST 2017

probinson added a comment.

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)

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.

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.


More information about the cfe-commits mailing list