This is an archive of the discontinued LLVM Phabricator instance.

[lld][thinlto] Include -mllvm options in the thinlto cache key
ClosedPublic

Authored by mtrofin on Sep 15 2022, 9:08 PM.

Details

Summary

They may modify thinlto optimization.

This patch only extends support for -mllvm. There is another way to pass llvm flags, -plugin-opt, but its processing is different and will be provided in a subsequent patch.

Diff Detail

Event Timeline

mtrofin created this revision.Sep 15 2022, 9:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 9:08 PM
mtrofin requested review of this revision.Sep 15 2022, 9:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 9:08 PM
MaskRay added inline comments.Sep 15 2022, 9:58 PM
lld/ELF/Driver.cpp
1352

emplace_back or push_back

lld/test/ELF/lto/cache.ll
53

Use ;; for non-RUN-non-CHECK comments.

54

In the top of the file and other places in test/ELF, we prefer rm -rf %t.cache && mkdir %t.cache in one line

llvm/include/llvm/LTO/Config.h
52

Move before PassPlugins for an alphabetical order among vector<string> variables.

are you planning on doing this for all the lld backends?

mtrofin updated this revision to Diff 460820.Sep 16 2022, 10:24 AM
mtrofin marked 4 inline comments as done.

feedback

lld/test/ELF/lto/cache.ll
54

ack - let me fix the other occurrence here then, too.

are you planning on doing this for all the lld backends?

Not sure - I'm looking for guidance as to how to approach that.

MaskRay accepted this revision.Sep 16 2022, 1:01 PM

LGTM. I think fixing just ELF is fine, but will be great if you fix COFF/MachO/WebAssembly as well as follow-up patches.
I'd recommend some options more general and more common than -mllvm -enable-ml-inliner=default -mllvm -max-devirt-iterations=1, but using them is fine, too.

lld/ELF/LTO.cpp
82

const auto => StringRef

This revision is now accepted and ready to land.Sep 16 2022, 1:01 PM
MaskRay added inline comments.Sep 16 2022, 1:02 PM
lld/test/ELF/lto/cache.ll
65

Perhaps change on test to use -plugin-opt=-max-... for some variance.

mtrofin updated this revision to Diff 460873.Sep 16 2022, 1:17 PM
mtrofin marked 2 inline comments as done.

also using -plugin-opt

LGTM. I think fixing just ELF is fine, but will be great if you fix COFF/MachO/WebAssembly as well as follow-up patches.

ack

I'd recommend some options more general and more common than -mllvm -enable-ml-inliner=default -mllvm -max-devirt-iterations=1, but using them is fine, too.

aeubanks accepted this revision.Sep 16 2022, 1:28 PM
mtrofin added inline comments.Sep 16 2022, 4:03 PM
lld/test/ELF/lto/cache.ll
65

huh, so it turns out -plugin-opt= is handled in a different way. Do we want to make the feature "force" --plugin-opt equivalence to -mllvm, or we're happy to treat them differently, and just validate that "it also works with --plugin-opt"?

mtrofin updated this revision to Diff 461277.Sep 19 2022, 11:03 AM

-plugin-opt isn't actually supported, needs explicit support

mtrofin edited the summary of this revision. (Show Details)Sep 19 2022, 11:04 AM