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

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 9 17:21:28 PST 2017


probinson added a comment.

In https://reviews.llvm.org/D28404#640682, @mehdi_amini wrote:

> > I'm now thinking along the lines of a `-foptimize-off` flag (bikesheds welcome) which would set the default for the pragma to 'off'.  How is that different than what you wanted for `-O0`?  It is defined in terms of an existing pragma, which is WAY easier to explain and WAY easier to implement.  And, it still lets us say that `-c -O0 -flto` is a mistake, if that seems like a useful thing to say.
>
> Well -O0 being actually "disable optimization", I found "way easier" to handle everything the same way (pragma, command line, etc.). I kind of find it confusing for the user to differentiate `-O0` from `-foptimize=off`. What is supposed to change between the two?


There is a pedantic difference, rooted in the still-true factoid that O0 != optnone.
If we redefine LTO as "Link Time Operation" (rather than Optimization; see my reply to Duncan)  then `-O0 -flto` is no longer an oxymoron, but using the attribute to imply the optimization level is still not good fidelity to what the user asked for.


https://reviews.llvm.org/D28404





More information about the cfe-commits mailing list