[PATCH] D123971: [clang] Enable SplitLTOUnits by default for SIE targets
Matthew Voss via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 18 17:45:02 PDT 2022
ormris created this revision.
ormris added reviewers: tejohnson, pcc, mehdi_amini.
Herald added a subscriber: inglorion.
Herald added a project: All.
ormris requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
This patch contains the SIE-specific parts of the unified LTO pipeline. See this conversation: https://discourse.llvm.org/t/rfc-a-unified-lto-bitcode-frontend/61774/15
https://reviews.llvm.org/D123971
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
llvm/include/llvm/Transforms/Utils/ModuleUtils.h
Index: llvm/include/llvm/Transforms/Utils/ModuleUtils.h
===================================================================
--- llvm/include/llvm/Transforms/Utils/ModuleUtils.h
+++ llvm/include/llvm/Transforms/Utils/ModuleUtils.h
@@ -105,7 +105,7 @@
/// If the module has no strong external symbols (such a module may still have a
/// semantic effect if it performs global initialization), we cannot produce a
/// unique identifier for this module, so we return the empty string.
-std::string getUniqueModuleId(Module *M);
+std::string getUniqueModuleId(Module *M, bool UnifiedLTO = false);
/// Embed the memory buffer \p Buf into the module \p M as a global using the
/// specified section name.
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1754,6 +1754,13 @@
Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args) << S;
}
+ if (Opts.UnifiedLTO) {
+ if (T.getOS() == llvm::Triple::PS4)
+ Opts.EnableSplitLTOUnit = false;
+ else
+ Opts.EnableSplitLTOUnit = true;
+ }
+
if (Arg *A = Args.getLastArg(OPT_fthinlto_index_EQ)) {
if (IK.getLanguage() != Language::LLVM_IR)
Diags.Report(diag::err_drv_argument_only_allowed_with)
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4551,10 +4551,11 @@
// Select the appropriate action.
RewriteKind rewriteKind = RK_None;
+ bool DefaultUnified = Triple.isPS4();
bool UnifiedLTO =
Args.hasFlag(options::OPT_funified_lto,
options::OPT_fno_unified_lto,
- false);
+ DefaultUnified);
if (UnifiedLTO)
CmdArgs.push_back("-funified-lto");
@@ -7043,7 +7044,8 @@
bool DefaultsSplitLTOUnit =
(WholeProgramVTables || SanitizeArgs.needsLTO()) &&
- (LTOMode == LTOK_Full || TC.canSplitThinLTOUnit());
+ (LTOMode == LTOK_Full || TC.canSplitThinLTOUnit()) ||
+ UnifiedLTO;
bool SplitLTOUnit =
Args.hasFlag(options::OPT_fsplit_lto_unit,
options::OPT_fno_split_lto_unit, DefaultsSplitLTOUnit);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123971.423498.patch
Type: text/x-patch
Size: 2356 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220419/61d7e18d/attachment.bin>
More information about the llvm-commits
mailing list