diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 79b23a8504097..2f649678b4f20 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -927,8 +927,8 @@ void EmitAssemblyHelper::RunOptimizationPipeline( // configure the pipeline. OptimizationLevel Level = mapToLevel(CodeGenOpts); - bool IsThinLTO = CodeGenOpts.PrepareForThinLTO; - bool IsLTO = CodeGenOpts.PrepareForLTO; + const bool PrepareForThinLTO = CodeGenOpts.PrepareForThinLTO; + const bool PrepareForLTO = CodeGenOpts.PrepareForLTO; if (LangOpts.ObjCAutoRefCount) { PB.registerPipelineStartEPCallback( @@ -1017,14 +1017,13 @@ void EmitAssemblyHelper::RunOptimizationPipeline( }); } - bool IsThinOrUnifiedLTO = IsThinLTO || (IsLTO && CodeGenOpts.UnifiedLTO); if (CodeGenOpts.FatLTO) { - MPM = PB.buildFatLTODefaultPipeline(Level, IsThinOrUnifiedLTO, - IsThinOrUnifiedLTO || + MPM = PB.buildFatLTODefaultPipeline(Level, PrepareForThinLTO, + PrepareForThinLTO || shouldEmitRegularLTOSummary()); - } else if (IsThinOrUnifiedLTO) { + } else if (PrepareForThinLTO) { MPM = PB.buildThinLTOPreLinkDefaultPipeline(Level); - } else if (IsLTO) { + } else if (PrepareForLTO) { MPM = PB.buildLTOPreLinkDefaultPipeline(Level); } else { MPM = PB.buildPerModuleDefaultPipeline(Level); @@ -1081,12 +1080,9 @@ void EmitAssemblyHelper::RunOptimizationPipeline( if (CodeGenOpts.FatLTO) { // Set module flags, like EnableSplitLTOUnit and UnifiedLTO, since FatLTO // uses a different action than Backend_EmitBC or Backend_EmitLL. - bool IsThinOrUnifiedLTO = - CodeGenOpts.PrepareForThinLTO || - (CodeGenOpts.PrepareForLTO && CodeGenOpts.UnifiedLTO); if (!TheModule->getModuleFlag("ThinLTO")) TheModule->addModuleFlag(Module::Error, "ThinLTO", - uint32_t(IsThinOrUnifiedLTO)); + uint32_t(CodeGenOpts.PrepareForThinLTO)); if (!TheModule->getModuleFlag("EnableSplitLTOUnit")) TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit", uint32_t(CodeGenOpts.EnableSplitLTOUnit));