Skip to content

Commit 4590c90

Browse files
ilovepitru
authored andcommitted
Revert "[clang] Preliminary fat-lto-object support"
FatLTO support is only half complete, and shouldn't be included in the 17.x release. https://reviews.llvm.org/D152973. This reverts commit 5784c47. This reverts commit 610fc5c.
1 parent 271731e commit 4590c90

File tree

10 files changed

+5
-151
lines changed

10 files changed

+5
-151
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,6 @@ Modified Compiler Flags
309309
directory (``/tmp`` on \*NIX systems, if none of the environment variables
310310
TMPDIR, TMP, and TEMP are specified).
311311

312-
- ``-ffat-lto-objects`` can now be used to emit object files with both object
313-
code and LLVM bitcode. Previously this flag was ignored for GCC compatibility.
314-
(`See related patch <https://reviews.llvm.org/D146777>`_).
315-
316312
Removed Compiler Flags
317313
-------------------------
318314
- The deprecated flag `-fmodules-ts` is removed. Please use ``-std=c++20``

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ CODEGENOPT(PrepareForThinLTO , 1, 0) ///< Set when -flto=thin is enabled on the
165165
///< compile step.
166166
CODEGENOPT(LTOUnit, 1, 0) ///< Emit IR to support LTO unit features (CFI, whole
167167
///< program vtable opt).
168-
CODEGENOPT(FatLTO, 1, 0) ///< Set when -ffat-lto-objects is enabled.
169168
CODEGENOPT(EnableSplitLTOUnit, 1, 0) ///< Enable LTO unit splitting to support
170169
/// CFI and traditional whole program
171170
/// devirtualization that require whole

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2375,11 +2375,6 @@ def fthin_link_bitcode_EQ : Joined<["-"], "fthin-link-bitcode=">,
23752375
Flags<[CoreOption, CC1Option]>, Group<f_Group>,
23762376
HelpText<"Write minimized bitcode to <file> for the ThinLTO thin link only">,
23772377
MarshallingInfoString<CodeGenOpts<"ThinLinkBitcodeFile">>;
2378-
defm fat_lto_objects : BoolFOption<"fat-lto-objects",
2379-
CodeGenOpts<"FatLTO">, DefaultFalse,
2380-
PosFlag<SetTrue, [CC1Option], "Enable">,
2381-
NegFlag<SetFalse, [CC1Option], "Disable">,
2382-
BothFlags<[CC1Option], " fat LTO object support">>;
23832378
def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">,
23842379
Group<f_Group>, Flags<[NoXarchOption, CC1Option, CoreOption]>,
23852380
HelpText<"Set the maximum number of entries to print in a macro expansion backtrace (0 = no limit)">,
@@ -5162,6 +5157,7 @@ defm caller_saves : BooleanFFlag<"caller-saves">, Group<clang_ignored_gcc_optimi
51625157
defm reorder_blocks : BooleanFFlag<"reorder-blocks">, Group<clang_ignored_gcc_optimization_f_Group>;
51635158
defm branch_count_reg : BooleanFFlag<"branch-count-reg">, Group<clang_ignored_gcc_optimization_f_Group>;
51645159
defm default_inline : BooleanFFlag<"default-inline">, Group<clang_ignored_gcc_optimization_f_Group>;
5160+
defm fat_lto_objects : BooleanFFlag<"fat-lto-objects">, Group<clang_ignored_gcc_optimization_f_Group>;
51655161
defm float_store : BooleanFFlag<"float-store">, Group<clang_ignored_gcc_optimization_f_Group>;
51665162
defm friend_injection : BooleanFFlag<"friend-injection">, Group<clang_ignored_f_Group>;
51675163
defm function_attribute_list : BooleanFFlag<"function-attribute-list">, Group<clang_ignored_f_Group>;

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
#include "llvm/Target/TargetOptions.h"
5656
#include "llvm/TargetParser/SubtargetFeature.h"
5757
#include "llvm/TargetParser/Triple.h"
58-
#include "llvm/Transforms/IPO/EmbedBitcodePass.h"
5958
#include "llvm/Transforms/IPO/LowerTypeTests.h"
6059
#include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
6160
#include "llvm/Transforms/InstCombine/InstCombine.h"
@@ -1016,12 +1015,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10161015
});
10171016
}
10181017

1019-
bool IsThinOrUnifiedLTO = IsThinLTO || (IsLTO && CodeGenOpts.UnifiedLTO);
1020-
if (CodeGenOpts.FatLTO) {
1021-
MPM = PB.buildFatLTODefaultPipeline(Level, IsThinOrUnifiedLTO,
1022-
IsThinOrUnifiedLTO ||
1023-
shouldEmitRegularLTOSummary());
1024-
} else if (IsThinOrUnifiedLTO) {
1018+
if (IsThinLTO || (IsLTO && CodeGenOpts.UnifiedLTO)) {
10251019
MPM = PB.buildThinLTOPreLinkDefaultPipeline(Level);
10261020
} else if (IsLTO) {
10271021
MPM = PB.buildLTOPreLinkDefaultPipeline(Level);
@@ -1077,21 +1071,6 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10771071
EmitLTOSummary));
10781072
}
10791073
}
1080-
if (CodeGenOpts.FatLTO) {
1081-
// Set module flags, like EnableSplitLTOUnit and UnifiedLTO, since FatLTO
1082-
// uses a different action than Backend_EmitBC or Backend_EmitLL.
1083-
bool IsThinOrUnifiedLTO =
1084-
CodeGenOpts.PrepareForThinLTO ||
1085-
(CodeGenOpts.PrepareForLTO && CodeGenOpts.UnifiedLTO);
1086-
if (!TheModule->getModuleFlag("ThinLTO"))
1087-
TheModule->addModuleFlag(Module::Error, "ThinLTO",
1088-
uint32_t(IsThinOrUnifiedLTO));
1089-
if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
1090-
TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
1091-
uint32_t(CodeGenOpts.EnableSplitLTOUnit));
1092-
if (CodeGenOpts.UnifiedLTO && !TheModule->getModuleFlag("UnifiedLTO"))
1093-
TheModule->addModuleFlag(Module::Error, "UnifiedLTO", uint32_t(1));
1094-
}
10951074

10961075
// Now that we have all of the passes ready, run them.
10971076
{

clang/lib/Driver/Driver.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4741,13 +4741,8 @@ Action *Driver::ConstructPhaseAction(
47414741
}
47424742
case phases::Backend: {
47434743
if (isUsingLTO() && TargetDeviceOffloadKind == Action::OFK_None) {
4744-
types::ID Output;
4745-
if (Args.hasArg(options::OPT_S))
4746-
Output = types::TY_LTO_IR;
4747-
else if (Args.hasArg(options::OPT_ffat_lto_objects))
4748-
Output = types::TY_PP_Asm;
4749-
else
4750-
Output = types::TY_LTO_BC;
4744+
types::ID Output =
4745+
Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC;
47514746
return C.MakeAction<BackendJobAction>(Input, Output);
47524747
}
47534748
if (isUsingLTO(/* IsOffload */ true) &&

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7376,22 +7376,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
73767376
if (SplitLTOUnit)
73777377
CmdArgs.push_back("-fsplit-lto-unit");
73787378

7379-
if (Arg *A = Args.getLastArg(options::OPT_ffat_lto_objects,
7380-
options::OPT_fno_fat_lto_objects)) {
7381-
if (IsUsingLTO && A->getOption().matches(options::OPT_ffat_lto_objects)) {
7382-
assert(LTOMode == LTOK_Full || LTOMode == LTOK_Thin);
7383-
if (!Triple.isOSBinFormatELF()) {
7384-
D.Diag(diag::err_drv_unsupported_opt_for_target)
7385-
<< A->getAsString(Args) << TC.getTripleString();
7386-
}
7387-
CmdArgs.push_back(Args.MakeArgString(
7388-
Twine("-flto=") + (LTOMode == LTOK_Thin ? "thin" : "full")));
7389-
CmdArgs.push_back("-flto-unit");
7390-
CmdArgs.push_back("-ffat-lto-objects");
7391-
A->render(Args, CmdArgs);
7392-
}
7393-
}
7394-
73957379
if (Arg *A = Args.getLastArg(options::OPT_fglobal_isel,
73967380
options::OPT_fno_global_isel)) {
73977381
CmdArgs.push_back("-mllvm");

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -621,11 +621,6 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
621621
PluginName + Suffix,
622622
Plugin);
623623
CmdArgs.push_back(Args.MakeArgString(Twine(PluginPrefix) + Plugin));
624-
} else {
625-
// Tell LLD to find and use .llvm.lto section in regular relocatable object
626-
// files
627-
if (Args.hasArg(options::OPT_ffat_lto_objects))
628-
CmdArgs.push_back("--fat-lto-objects");
629624
}
630625

631626
const char *PluginOptPrefix = IsOSAIX ? "-bplugin_opt:" : "-plugin-opt=";

clang/test/CodeGen/fat-lto-objects.c

Lines changed: 0 additions & 57 deletions
This file was deleted.

clang/test/Driver/clang_f_opts.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@
424424
// CHECK-WARNING-DAG: optimization flag '-fwhole-program' is not supported
425425
// CHECK-WARNING-DAG: optimization flag '-fcaller-saves' is not supported
426426
// CHECK-WARNING-DAG: optimization flag '-freorder-blocks' is not supported
427+
// CHECK-WARNING-DAG: optimization flag '-ffat-lto-objects' is not supported
427428
// CHECK-WARNING-DAG: optimization flag '-fmerge-constants' is not supported
428429
// CHECK-WARNING-DAG: optimization flag '-finline-small-functions' is not supported
429430
// CHECK-WARNING-DAG: optimization flag '-ftree-dce' is not supported

clang/test/Driver/fat-lto-objects.c

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)