Page MenuHomePhabricator

[WIP][clang][lld] A Unified LTO Bitcode Frontend
Needs ReviewPublic

Authored by ormris on Apr 14 2022, 9:41 AM.

Details

Summary

Here's a high level summary of the changes in this patch. For more information
on rational, see the RFC (https://discourse.llvm.org/t/rfc-a-unified-lto-bitcode-frontend/61774).

  • Add flags to the clang driver to enable the unified LTO pipeline.
  • When this mode is enabled, add the "UnifiedLTO" module flag to any bitcode modules generated.
  • Use the Full (Regular) LTO passes to optimize LTO bitcode modules in the frontend when using unified LTO.
  • Emit type metadata when this pipeline is enabled.
  • Add LLD driver changes to this patch.

Diff Detail

Event Timeline

ormris created this revision.Apr 14 2022, 9:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2022, 9:41 AM
ormris requested review of this revision.Apr 14 2022, 9:41 AM
ormris edited the summary of this revision. (Show Details)Apr 14 2022, 9:48 AM
ormris edited the summary of this revision. (Show Details)Apr 14 2022, 10:17 AM
ormris edited the summary of this revision. (Show Details)

As mentioned on the RFC thread a little bit ago, I think the split LTO handling should be separated from the unified LTO pipeline. So some of these comments may be moot if that is done.

clang/lib/CodeGen/BackendUtil.cpp
950–951

I think this ?: logic is all equivalent to simply setting the flag to !CodeGenOpts.UnifiedLTO. While as noted elsewhere I'd like to separate the split LTO unit handling from the unified LTO pipeline model, I'm not sure I understand why you would want to set this module flag to false when CodeGenOpts.UnifiedLTO==true under the current patch intent.

clang/lib/Driver/ToolChains/Clang.cpp
4694

Why the PS4 special handling? Also, shouldn't LTO unit be enabled in unified LTO mode?

7047

I'd like to separate the split LTO unit setting from Unified LTO as I think they are orthogonal.

clang/lib/Frontend/CompilerInvocation.cpp
1743

Opts.PrepareForLTO was set to false a couple lines up, so I don't think this if condition will ever evaluate to true?

1758

Why is the default being set differently for PS4?

ormris updated this revision to Diff 423495.Apr 18 2022, 5:25 PM
ormris retitled this revision from [WIP][clang] A Unified LTO Bitcode Frontend to [WIP][clang][lld] A Unified LTO Bitcode Frontend.
ormris edited the summary of this revision. (Show Details)

Add LLD driver changes to this patch. Disable split LTO units by default. As discussed here: https://discourse.llvm.org/t/rfc-a-unified-lto-bitcode-frontend/61774/15