This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Fix empty .llvmcmd sections
ClosedPublic

Authored by mtrofin on Oct 28 2020, 8:20 PM.

Details

Summary

When passing -lto-embed-bitcode=post-merge-pre-opt, we were getting
empty .llvmcmd sections. It turns out that is because the
CodeGenOptions::CmdArgs field was only populated when clang saw
-fembed-bitcode={all|marker}.

This patch always populates the CodeGenOptions::CmdArgs. The overhead
of carrying through in memory in all cases is likely negligible in
the grand schema of things, and it keeps the using code simple.

Diff Detail

Event Timeline

mtrofin created this revision.Oct 28 2020, 8:20 PM
mtrofin requested review of this revision.Oct 28 2020, 8:20 PM

The motivation and effects of the change are unclear to me. Does this mean that the .llvmcmd section is always emitted? Or always emitted whenever any bitcode embedding is requested?

clang/test/CodeGen/thinlto_embed_bitcode.ll
28

Incomplete sentence

The motivation and effects of the change are unclear to me. Does this mean that the .llvmcmd section is always emitted? Or always emitted whenever any bitcode embedding is requested?

This just means the arguments are captured in memory. Nothing else changes. The only penalty is that a char vector (the captured args) are carried around even if .llvmcmd wasn't generated.

We could maybe add a test that no explicit optin to emitting .llvmcmd => no section (briefly looked, doesn't seem to exist for either non- or thinlto)

mtrofin updated this revision to Diff 301641.Oct 29 2020, 8:46 AM

fixed sentence

mtrofin retitled this revision from [ThinLTO] Strenghten the test for .llvmcmd embedding to [ThinLTO] Fix empty .llvmcmd sections.Oct 29 2020, 9:16 AM
mtrofin edited the summary of this revision. (Show Details)
mtrofin updated this revision to Diff 301650.Oct 29 2020, 9:16 AM
mtrofin marked an inline comment as done.

updated description

This revision is now accepted and ready to land.Oct 29 2020, 9:21 AM
This revision was landed with ongoing or failed builds.Oct 29 2020, 9:58 AM
This revision was automatically updated to reflect the committed changes.