Page MenuHomePhabricator

[ThinLTO] add post-thinlto-merge option to -lto-embed-bitcode
ClosedPublic

Authored by mtrofin on Sep 14 2020, 2:39 PM.

Details

Summary

This will embed bitcode after (Thin)LTO merge, but before optimizations.
In the case the thinlto backend is called from clang, the .llvmcmd
section is also produced. Doing so in the case where the caller is the
linker doesn't yet have a motivation, and would require plumbing through
command line args.

Diff Detail

Event Timeline

mtrofin created this revision.Sep 14 2020, 2:39 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
mtrofin requested review of this revision.Sep 14 2020, 2:39 PM
mtrofin added inline comments.Sep 14 2020, 2:43 PM
clang/test/CodeGen/Inputs/start-lib2.ll
4

The message that this was copied from llvm/test/LTO/X86/Inputs/start-lib1.ll is incorrect - this is exactly start-lib2.ll. No idea how this was determined.

tejohnson added inline comments.Sep 15 2020, 3:06 PM
llvm/lib/LTO/LTOBackend.cpp
639

How about putting this at the start of opt() instead? Then it works for both Thin and Regular LTO. I would change the name to something like EmbedPreOptimized or something like that. Or EmbedPostMergePreOptimized if you want to be very exact (either name fits for the regular LTO scenario as well).

llvm/test/LTO/X86/embed-bitcode.ll
11

Probably check the new case here too once it works for regular LTO as suggested above.

mtrofin edited the summary of this revision. (Show Details)Sep 15 2020, 3:38 PM
tejohnson accepted this revision.Sep 15 2020, 3:41 PM

LGTM, just needs a comment update as noted below and also an update to the patch title.

llvm/lib/LTO/LTOBackend.cpp
368

Update comment

This revision is now accepted and ready to land.Sep 15 2020, 3:41 PM
mtrofin updated this revision to Diff 292041.Sep 15 2020, 3:45 PM
mtrofin marked 3 inline comments as done.

comment update

llvm/lib/LTO/LTOBackend.cpp
368

oh, yes... done

This revision was landed with ongoing or failed builds.Sep 15 2020, 3:56 PM
This revision was automatically updated to reflect the committed changes.