This is an archive of the discontinued LLVM Phabricator instance.

[LTO] Allow passing -Os/-Oz as the optimization level
AbandonedPublic

Authored by aeubanks on Nov 11 2021, 11:22 PM.

Details

Reviewers
MaskRay
gkm
Group Reviewers
Restricted Project

Diff Detail

Event Timeline

aeubanks created this revision.Nov 11 2021, 11:22 PM
Herald added a reviewer: gkm. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a reviewer: Restricted Project. · View Herald Transcript
aeubanks requested review of this revision.Nov 11 2021, 11:22 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 11 2021, 11:22 PM
fhahn added a subscriber: fhahn.Nov 12 2021, 1:32 AM

Could you add tests on the LLVM side for the new options as well? See also D95541

aeubanks updated this revision to Diff 386882.Nov 12 2021, 10:25 AM

add more tests

pcc added a subscriber: pcc.Nov 12 2021, 10:46 AM

Please see D63976 where we rejected a similar change in favor of just letting this be controllable at compile time.

To the extent that the pass pipeline is affected by the size optimization level, I think we should change the passes so that they respect the optsize/minsize attributes.

thevinster added inline comments.
lld/Common/Args.cpp
29

nit: getOptLevel seems a bit too generic for something that's LTO specific. The MachO port has the concept of passing an opt level that generates more efficient opcodes. Suggestions are welcome here - perhaps getLTOOptLevel would be better here?

MaskRay requested changes to this revision.Feb 14 2022, 9:59 AM

D72404 has some comments why the -Os/-Oz levels are discouraged.

This revision now requires changes to proceed.Feb 14 2022, 9:59 AM
aeubanks abandoned this revision.Feb 15 2022, 1:41 PM

I posted an RFC a while back for basically removing size levels from optimization levels but never seriously looked into it: https://groups.google.com/g/llvm-dev/c/NrZsR8OZTts/m/P5t14TKaAQAJ