[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin
Mehdi AMINI via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 14 08:06:21 PDT 2017
mehdi_amini added a comment.
In https://reviews.llvm.org/D30920#700433, @tejohnson wrote:
> In https://reviews.llvm.org/D30920#700133, @pcc wrote:
> > In https://reviews.llvm.org/D30920#700077, @tejohnson wrote:
> > > Until everything is converted to using size attributes, it seems like a correct fix for the bug is to accept these options in the gold-plugin and pass through the LTO API to the PassManagerBuilder.
> > Not necessarily. There is no requirement (from a correctness perspective) that `-Os` at link time should exactly match the behaviour of `-Os` at compile time.
> Sure, but there is certainly a perception that optimization flags affecting the non-LTO pipeline should similarly affect the LTO pipeline. LTO should be transparent to the user, so if -Os behaves one way without LTO, it seems problematic to me if it behaves a different way with LTO.
> That being said, agree that the best way to enforce that is to pass the relevant flags through the IR. (On the flip side, if the user passes -O1 to the link step, it does get passed through to the plugin and affects the LTO optimization pipeline...)
I agree that I don't like the discrepancy: the driver should *not* drop -Os silently if it passes down -O1/-O2/-O3, a warning is the minimum.
More information about the cfe-commits