Page MenuHomePhabricator

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

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

Details

Summary

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

The optimization level mapping matches
CompilerInvocation.cpp:getOptimizationLevel() and SpeedLevel of
PassBuilder::OptimizationLevel::O*.

-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

LGTM

clang/test/Driver/lto.c
52

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.

clang/test/Driver/lto.c
52

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?