Skip to content

Commit a4605af

Browse files
authored
[CodeGen][LTO] Rename some misleading variables (#65185)
Some flags named "IsLTO" and "IsThinLTO" implied they described compilation modes, but with Unified LTO this is no longer true. Rename these to "PrepForXXX" to be less confusing to readers. Also, deleted "IsThinOrUnifiedLTO" because Unified implies PrepareForThinLTO.
1 parent c177350 commit a4605af

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -927,8 +927,8 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
927927
// configure the pipeline.
928928
OptimizationLevel Level = mapToLevel(CodeGenOpts);
929929

930-
bool IsThinLTO = CodeGenOpts.PrepareForThinLTO;
931-
bool IsLTO = CodeGenOpts.PrepareForLTO;
930+
const bool PrepareForThinLTO = CodeGenOpts.PrepareForThinLTO;
931+
const bool PrepareForLTO = CodeGenOpts.PrepareForLTO;
932932

933933
if (LangOpts.ObjCAutoRefCount) {
934934
PB.registerPipelineStartEPCallback(
@@ -1017,14 +1017,13 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10171017
});
10181018
}
10191019

1020-
bool IsThinOrUnifiedLTO = IsThinLTO || (IsLTO && CodeGenOpts.UnifiedLTO);
10211020
if (CodeGenOpts.FatLTO) {
1022-
MPM = PB.buildFatLTODefaultPipeline(Level, IsThinOrUnifiedLTO,
1023-
IsThinOrUnifiedLTO ||
1021+
MPM = PB.buildFatLTODefaultPipeline(Level, PrepareForThinLTO,
1022+
PrepareForThinLTO ||
10241023
shouldEmitRegularLTOSummary());
1025-
} else if (IsThinOrUnifiedLTO) {
1024+
} else if (PrepareForThinLTO) {
10261025
MPM = PB.buildThinLTOPreLinkDefaultPipeline(Level);
1027-
} else if (IsLTO) {
1026+
} else if (PrepareForLTO) {
10281027
MPM = PB.buildLTOPreLinkDefaultPipeline(Level);
10291028
} else {
10301029
MPM = PB.buildPerModuleDefaultPipeline(Level);
@@ -1081,12 +1080,9 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10811080
if (CodeGenOpts.FatLTO) {
10821081
// Set module flags, like EnableSplitLTOUnit and UnifiedLTO, since FatLTO
10831082
// uses a different action than Backend_EmitBC or Backend_EmitLL.
1084-
bool IsThinOrUnifiedLTO =
1085-
CodeGenOpts.PrepareForThinLTO ||
1086-
(CodeGenOpts.PrepareForLTO && CodeGenOpts.UnifiedLTO);
10871083
if (!TheModule->getModuleFlag("ThinLTO"))
10881084
TheModule->addModuleFlag(Module::Error, "ThinLTO",
1089-
uint32_t(IsThinOrUnifiedLTO));
1085+
uint32_t(CodeGenOpts.PrepareForThinLTO));
10901086
if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
10911087
TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
10921088
uint32_t(CodeGenOpts.EnableSplitLTOUnit));

0 commit comments

Comments
 (0)