rustc_llvm: Emit module summaries when using -Clto=fat#159029
Conversation
|
r? @cuviper rustbot has assigned @cuviper. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| /// "ThinLTO" metadata is defined and explicitly set to zero. Otherwise, | ||
| /// the thin LTO block ID will be emitted. | ||
| static void forceFullLTOSummary(Module *M) { | ||
| if (!M->getModuleFlag("ThinLTO")) { |
There was a problem hiding this comment.
I suspect this can be an assert(!M->getModuleFlag("ThinLTO")) since this should never really be called if thinlto was used at all.
|
cc @ilovepi |
141d64a to
10ed1e0
Compare
This comment has been minimized.
This comment has been minimized.
Currently, module summaries are only emitted with thin lto. If we would link full/fat lto'd rust code against lto'd c++ code built with CFI (or WPD), those passes would fail during the link step because the participating rust modules are missing module summaries. Rust code does not know at compile-time if it would be participating in some special link which may require module summaries, so this PR ensures module summaries are unconditionally emitted for full/fat lto, just like with thin lto. The WriteBitcodeToFile function just invokes the normal BitcodeWriterPass under the hood, but doesn't provide a way to set the argument for emitting module summaries. So this patch just adds the pass directly and sets that argument.
10ed1e0 to
25ec857
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
The job Click to see the possible cause of the failure (guessed by this bot)Important For more information how to resolve CI failures of this job, visit this link. |
Currently, module summaries are only emitted with thin lto. If we would link full/fat lto'd rust code against lto'd c++ code built with CFI (or WPD), those passes would fail during the link step because the participating rust modules are missing module summaries. Rust code does not know at compile-time if it would be participating in some special link which may require module summaries, so this PR ensures module summaries are unconditionally emitted for full/fat lto, just like with thin lto.
The WriteBitcodeToFile function just invokes the normal BitcodeWriterPass under the hood, but doesn't provide a way to set the argument for emitting module summaries. So this patch just adds the pass directly and sets that argument.
This is a rebase of @PiJoules's #158099, which also should fix up the tests with the gcc tools.