Skip to content

Commit

Permalink
[NFC][PassBuilder] addVectorPasses(): clarify that 'IsLTO' is actuall…
Browse files Browse the repository at this point in the history
…y 'IsFullLTO'

I.e. it will be `false` for thin lto.
  • Loading branch information
LebedevRI committed Jul 1, 2021
1 parent 07f0fae commit 333d3a3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/Passes/PassBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ class PassBuilder {
void addRequiredLTOPreLinkPasses(ModulePassManager &MPM);

void addVectorPasses(OptimizationLevel Level, FunctionPassManager &FPM,
bool IsLTO);
bool IsFullLTO);

static Optional<std::vector<PipelineElement>>
parsePipelineText(StringRef Text);
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ class PassManagerBuilder {
void addLateLTOOptimizationPasses(legacy::PassManagerBase &PM);
void addPGOInstrPasses(legacy::PassManagerBase &MPM, bool IsCS);
void addFunctionSimplificationPasses(legacy::PassManagerBase &MPM);
void addVectorPasses(legacy::PassManagerBase &PM, bool IsLTO);
void addVectorPasses(legacy::PassManagerBase &PM, bool IsFullLTO);

public:
/// populateFunctionPassManager - This fills in the function pass manager,
/// which is expected to be run on each function immediately as it is
Expand Down
16 changes: 8 additions & 8 deletions llvm/lib/Passes/PassBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1198,11 +1198,11 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,

/// TODO: Should LTO cause any differences to this set of passes?
void PassBuilder::addVectorPasses(OptimizationLevel Level,
FunctionPassManager &FPM, bool IsLTO) {
FunctionPassManager &FPM, bool IsFullLTO) {
FPM.addPass(LoopVectorizePass(
LoopVectorizeOptions(!PTO.LoopInterleaving, !PTO.LoopVectorization)));

if (IsLTO) {
if (IsFullLTO) {
// The vectorizer may have significantly shortened a loop body; unroll
// again. Unroll small loops to hide loop backedge latency and saturate any
// parallel execution resources of an out-of-order processor. We also then
Expand All @@ -1220,7 +1220,7 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
FPM.addPass(WarnMissedTransformationsPass());
}

if (!IsLTO) {
if (!IsFullLTO) {
// Eliminate loads by forwarding stores from the previous iteration to loads
// of the current iteration.
FPM.addPass(LoopLoadEliminationPass());
Expand Down Expand Up @@ -1267,7 +1267,7 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
.hoistCommonInsts(true)
.sinkCommonInsts(true)));

if (IsLTO) {
if (IsFullLTO) {
FPM.addPass(SCCPPass());
FPM.addPass(InstCombinePass());
FPM.addPass(BDCEPass());
Expand All @@ -1283,7 +1283,7 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
// Enhance/cleanup vector code.
FPM.addPass(VectorCombinePass());

if (!IsLTO) {
if (!IsFullLTO) {
FPM.addPass(InstCombinePass());
// Unroll small loops to hide loop backedge latency and saturate any
// parallel execution resources of an out-of-order processor. We also then
Expand Down Expand Up @@ -1312,7 +1312,7 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level,
// alignment information, try to re-derive it here.
FPM.addPass(AlignmentFromAssumptionsPass());

if (IsLTO)
if (IsFullLTO)
FPM.addPass(InstCombinePass());
}

Expand Down Expand Up @@ -1410,7 +1410,7 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
// from the TargetLibraryInfo.
OptimizePM.addPass(InjectTLIMappings());

addVectorPasses(Level, OptimizePM, /* IsLTO */ false);
addVectorPasses(Level, OptimizePM, /* IsFullLTO */ false);

// Split out cold code. Splitting is done late to avoid hiding context from
// other optimizations and inadvertently regressing performance. The tradeoff
Expand Down Expand Up @@ -1862,7 +1862,7 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,

MainFPM.addPass(LoopDistributePass());

addVectorPasses(Level, MainFPM, /* IsLTO */ true);
addVectorPasses(Level, MainFPM, /* IsFullLTO */ true);

invokePeepholeEPCallbacks(MainFPM, Level);
MainFPM.addPass(JumpThreadingPass(/*InsertFreezeWhenUnfoldingSelect*/ true));
Expand Down
16 changes: 8 additions & 8 deletions llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,10 @@ void PassManagerBuilder::addFunctionSimplificationPasses(

/// FIXME: Should LTO cause any differences to this set of passes?
void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM,
bool IsLTO) {
bool IsFullLTO) {
PM.add(createLoopVectorizePass(!LoopsInterleaved, !LoopVectorize));

if (IsLTO) {
if (IsFullLTO) {
// The vectorizer may have significantly shortened a loop body; unroll
// again. Unroll small loops to hide loop backedge latency and saturate any
// parallel execution resources of an out-of-order processor. We also then
Expand All @@ -550,7 +550,7 @@ void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM,
PM.add(createWarnMissedTransformationsPass());
}

if (!IsLTO) {
if (!IsFullLTO) {
// Eliminate loads by forwarding stores from the previous iteration to loads
// of the current iteration.
PM.add(createLoopLoadEliminationPass());
Expand Down Expand Up @@ -590,7 +590,7 @@ void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM,
.hoistCommonInsts(true)
.sinkCommonInsts(true)));

if (IsLTO) {
if (IsFullLTO) {
PM.add(createSCCPPass()); // Propagate exposed constants
PM.add(createInstructionCombiningPass()); // Clean up again
PM.add(createBitTrackingDCEPass());
Expand All @@ -606,7 +606,7 @@ void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM,
// Enhance/cleanup vector code.
PM.add(createVectorCombinePass());

if (!IsLTO) {
if (!IsFullLTO) {
addExtensionsToPM(EP_Peephole, PM);
PM.add(createInstructionCombiningPass());

Expand Down Expand Up @@ -639,7 +639,7 @@ void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM,
// about pointer alignments.
PM.add(createAlignmentFromAssumptionsPass());

if (IsLTO)
if (IsFullLTO)
PM.add(createInstructionCombiningPass());
}

Expand Down Expand Up @@ -918,7 +918,7 @@ void PassManagerBuilder::populateModulePassManager(
// llvm.loop.distribute=true or when -enable-loop-distribute is specified.
MPM.add(createLoopDistributePass());

addVectorPasses(MPM, /* IsLTO */ false);
addVectorPasses(MPM, /* IsFullLTO */ false);

// FIXME: We shouldn't bother with this anymore.
MPM.add(createStripDeadPrototypesPass()); // Get rid of dead prototypes
Expand Down Expand Up @@ -1133,7 +1133,7 @@ void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) {
ForgetAllSCEVInLoopUnroll));
PM.add(createLoopDistributePass());

addVectorPasses(PM, /* IsLTO */ true);
addVectorPasses(PM, /* IsFullLTO */ true);

addExtensionsToPM(EP_Peephole, PM);

Expand Down

0 comments on commit 333d3a3

Please sign in to comment.