This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Pass -plugin-opt=O2 for -Os -Oz and -plugin-opt=O1 for -Og

Authored by MaskRay on May 13 2020, 5:52 PM.



Fixes PR42445 (-Os -Oz translate to -plugin-opt=Os (Oz) which cannot be
recognized by or LLD).

The optimization level mapping matches
CompilerInvocation.cpp:getOptimizationLevel() and SpeedLevel of

-plugin-opt=O* affects the way we construct regular LTO/ThinLTO pass
manager pipeline.

Diff Detail

Event Timeline

MaskRay created this revision.May 13 2020, 5:52 PM

LGTM, probably want @pcc to approve as well.

pcc accepted this revision.May 14 2020, 10:13 AM



I think this one should be --check-prefix=O2.

This revision is now accepted and ready to land.May 14 2020, 10:13 AM
MaskRay marked an inline comment as done.May 14 2020, 10:29 AM

Thanks for the review. Will remove D79916 as a parent and commit this one first.


I added D79916 as a parent:)

Looks like I should just land this patch first and probably update the test in D79916.

MaskRay updated this revision to Diff 264027.May 14 2020, 10:36 AM
MaskRay edited the summary of this revision. (Show Details)

-O => -O2 (temporarily, pending on the resolution of D79916)

Add a test for -Ofast

This revision was automatically updated to reflect the committed changes.

Great! Maybe worth to add a release note that -Os works with LTO?