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

Mehdi AMINI via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 9 12:08:48 PST 2017


mehdi_amini added a comment.

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

> In https://reviews.llvm.org/D28404#639887, @mehdi_amini wrote:
>
> > In https://reviews.llvm.org/D28404#639874, @probinson wrote:
> >
> > > Over the weekend I had a thought:  Why is -O0 so special here?  That is, after going to all this trouble to propagate -O0 to LTO, how does this generalize to propagating -O1 or any other specific -O option?  (Maybe this question would be better dealt with on the dev list...)
> >
> >
> > O0 is "special" like Os and Oz because we have an attribute for it and passes "know" how to handle this attribute.
> >  I guess no-one cares enough about https://reviews.llvm.org/owners/package/1//https://reviews.llvm.org/owners/package/2//O3 to find a solution for these (in the context of LTO, I don't really care about https://reviews.llvm.org/owners/package/1//https://reviews.llvm.org/owners/package/2/).
> >  It is likely that Og would need a special treatment at some point, maybe with a new attribute as well, to inhibit optimization that can't preserve debug info properly.
>
>
> "I don't care" doesn't seem like much of a principle.


Long version is: "There is no use-case, no users, so I don't have much motivation to push it forward for the only sake of completeness". Does it sound enough of a principle like that?

> Optnone does not equal -O0.  It is a debugging aid for the programmer, because debugging optimized code sucks.  If you have an LTO-built application and want to de-optimize parts of it to aid with debugging, then you can use the pragma, as originally intended.

Having to modifying the source isn't friendly. Not being able to honor -O0 during LTO is not user-friendly.

>   I don't think `-c -O0` should get this not-entirely-O0-like behavior.

What is "not-entirely"? And why do you think that?


https://reviews.llvm.org/D28404





More information about the cfe-commits mailing list