Skip to content

Commit

Permalink
[opt][NewPM] Add isRequired to passes named as *PrinterPass (#76516)
Browse files Browse the repository at this point in the history
Passes that print the result of analysis passes should be of interest, and
are expected to run even if a function for example is marked as optnone.
So when adding such passes explicitly to a pipeline it makes sense to
run the pass regardless of standard instrumentation gates such as
OptNoneInstrumentation.

In this patch all passes named as *PrinterPass are marked as required.
That should make sure that those passes are executed
without being skipped due to standard instrumentations.

The polly passes are not touched in this patch.

Partial fix for: #76762
  • Loading branch information
bjope committed Jan 3, 2024
1 parent 1d27669 commit d09315d
Show file tree
Hide file tree
Showing 43 changed files with 75 additions and 1 deletion.
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/AliasSetTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ class AliasSetsPrinterPass : public PassInfoMixin<AliasSetsPrinterPass> {
public:
explicit AliasSetsPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};

} // end namespace llvm
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/AssumptionCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ class AssumptionPrinterPass : public PassInfoMixin<AssumptionPrinterPass> {
explicit AssumptionPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// An immutable pass that tracks lazily created \c AssumptionCache
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/BlockFrequencyInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ class BlockFrequencyPrinterPass
explicit BlockFrequencyPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// Legacy analysis pass which computes \c BlockFrequencyInfo.
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/BranchProbabilityInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ class BranchProbabilityPrinterPass
explicit BranchProbabilityPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// Legacy analysis pass which computes \c BranchProbabilityInfo.
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/CFGSCCPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class CFGSCCPrinterPass : public PassInfoMixin<CFGSCCPrinterPass> {
public:
explicit CFGSCCPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // namespace llvm

Expand Down
4 changes: 4 additions & 0 deletions llvm/include/llvm/Analysis/CallGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ class CallGraphPrinterPass : public PassInfoMixin<CallGraphPrinterPass> {
explicit CallGraphPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// Printer pass for the summarized \c CallGraphAnalysis results.
Expand All @@ -333,6 +335,8 @@ class CallGraphSCCsPrinterPass
explicit CallGraphSCCsPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// The \c ModulePass which wraps up a \c CallGraph and the logic to
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/CallPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ class ModulePass;
class CallGraphDOTPrinterPass : public PassInfoMixin<CallGraphDOTPrinterPass> {
public:
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};

/// Pass for viewing the call graph
class CallGraphViewerPass : public PassInfoMixin<CallGraphViewerPass> {
public:
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};

ModulePass *createCallGraphViewerPass();
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/CostModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class CostModelPrinterPass : public PassInfoMixin<CostModelPrinterPass> {
explicit CostModelPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};
} // end namespace llvm

Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/CycleAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class CycleInfoPrinterPass : public PassInfoMixin<CycleInfoPrinterPass> {
explicit CycleInfoPrinterPass(raw_ostream &OS);

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

} // end namespace llvm
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/DDG.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ class DDGAnalysisPrinterPass : public PassInfoMixin<DDGAnalysisPrinterPass> {
explicit DDGAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
LoopStandardAnalysisResults &AR, LPMUpdater &U);
static bool isRequired() { return true; }

private:
raw_ostream &OS;
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/DDGPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class DDGDotPrinterPass : public PassInfoMixin<DDGDotPrinterPass> {
public:
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
LoopStandardAnalysisResults &AR, LPMUpdater &U);
static bool isRequired() { return true; }
};

//===--------------------------------------------------------------------===//
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/Delinearization.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ struct DelinearizationPrinterPass
: public PassInfoMixin<DelinearizationPrinterPass> {
explicit DelinearizationPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }

private:
raw_ostream &OS;
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/DemandedBits.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ class DemandedBitsPrinterPass : public PassInfoMixin<DemandedBitsPrinterPass> {
explicit DemandedBitsPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

} // end namespace llvm
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/DependenceAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,8 @@ namespace llvm {

PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);

static bool isRequired() { return true; }

private:
raw_ostream &OS;
bool NormalizeResults;
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/DominanceFrontier.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ class DominanceFrontierPrinterPass
explicit DominanceFrontierPrinterPass(raw_ostream &OS);

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

} // end namespace llvm
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ class FunctionPropertiesPrinterPass
explicit FunctionPropertiesPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// Correctly update FunctionPropertiesInfo post-inlining. A
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,7 @@ class IRSimilarityAnalysisPrinterPass
public:
explicit IRSimilarityAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};

} // end namespace llvm
Expand Down
3 changes: 2 additions & 1 deletion llvm/include/llvm/Analysis/InlineAdvisor.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class InlineAdvisorAnalysis : public AnalysisInfoMixin<InlineAdvisorAnalysis> {
Result run(Module &M, ModuleAnalysisManager &MAM) { return Result(M, MAM); }
};

/// Printer pass for the FunctionPropertiesAnalysis results.
/// Printer pass for the InlineAdvisorAnalysis results.
class InlineAdvisorAnalysisPrinterPass
: public PassInfoMixin<InlineAdvisorAnalysisPrinterPass> {
raw_ostream &OS;
Expand All @@ -353,6 +353,7 @@ class InlineAdvisorAnalysisPrinterPass

PreservedAnalyses run(LazyCallGraph::SCC &InitialC, CGSCCAnalysisManager &AM,
LazyCallGraph &CG, CGSCCUpdateResult &UR);
static bool isRequired() { return true; }
};

std::unique_ptr<InlineAdvisor>
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/InlineCost.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ struct InlineCostAnnotationPrinterPass
public:
explicit InlineCostAnnotationPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
static bool isRequired() { return true; }
};
} // namespace llvm

Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/InlineSizeEstimatorAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class InlineSizeEstimatorAnalysisPrinterPass
explicit InlineSizeEstimatorAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};
} // namespace llvm
#endif // LLVM_ANALYSIS_INLINESIZEESTIMATORANALYSIS_H
4 changes: 4 additions & 0 deletions llvm/include/llvm/Analysis/LazyCallGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,8 @@ class LazyCallGraphPrinterPass
explicit LazyCallGraphPrinterPass(raw_ostream &OS);

PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// A pass which prints the call graph as a DOT file to a \c raw_ostream.
Expand All @@ -1301,6 +1303,8 @@ class LazyCallGraphDOTPrinterPass
explicit LazyCallGraphDOTPrinterPass(raw_ostream &OS);

PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);

static bool isRequired() { return true; }
};

} // end namespace llvm
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/LazyValueInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ class LazyValueInfoPrinterPass
explicit LazyValueInfoPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// Wrapper around LazyValueInfo.
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/LoopCacheAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ class LoopCachePrinterPass : public PassInfoMixin<LoopCachePrinterPass> {

PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
LoopStandardAnalysisResults &AR, LPMUpdater &U);

static bool isRequired() { return true; }
};

} // namespace llvm
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/LoopInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ class LoopPrinterPass : public PassInfoMixin<LoopPrinterPass> {
public:
explicit LoopPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};

/// Verifier pass for the \c LoopAnalysis results.
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/LoopNestAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ class LoopNestPrinterPass : public PassInfoMixin<LoopNestPrinterPass> {

PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
LoopStandardAnalysisResults &AR, LPMUpdater &U);

static bool isRequired() { return true; }
};

} // namespace llvm
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/MemDerefPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class MemDerefPrinterPass : public PassInfoMixin<MemDerefPrinterPass> {
public:
MemDerefPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // namespace llvm

Expand Down
4 changes: 4 additions & 0 deletions llvm/include/llvm/Analysis/MemorySSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,8 @@ class MemorySSAPrinterPass : public PassInfoMixin<MemorySSAPrinterPass> {
: OS(OS), EnsureOptimizedUses(EnsureOptimizedUses) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// Printer pass for \c MemorySSA via the walker.
Expand All @@ -964,6 +966,8 @@ class MemorySSAWalkerPrinterPass
explicit MemorySSAWalkerPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// Verifier pass for \c MemorySSA.
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/ModuleDebugInfoPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ModuleDebugInfoPrinterPass
public:
explicit ModuleDebugInfoPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // end namespace llvm

Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/MustExecute.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ class MustExecutePrinterPass : public PassInfoMixin<MustExecutePrinterPass> {
public:
MustExecutePrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};

class MustBeExecutedContextPrinterPass
Expand All @@ -556,6 +557,7 @@ class MustBeExecutedContextPrinterPass
public:
MustBeExecutedContextPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};

} // namespace llvm
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/PhiValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class PhiValuesPrinterPass : public PassInfoMixin<PhiValuesPrinterPass> {
public:
explicit PhiValuesPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};

/// Wrapper pass for the legacy pass manager
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/PostDominators.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class PostDominatorTreePrinterPass
explicit PostDominatorTreePrinterPass(raw_ostream &OS);

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

struct PostDominatorTreeWrapperPass : public FunctionPass {
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/ProfileSummaryInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ class ProfileSummaryPrinterPass
public:
explicit ProfileSummaryPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};

} // end namespace llvm
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/RegionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,8 @@ class RegionInfoPrinterPass : public PassInfoMixin<RegionInfoPrinterPass> {
explicit RegionInfoPrinterPass(raw_ostream &OS);

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// Verifier pass for the \c RegionInfo.
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/ScalarEvolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -2257,6 +2257,8 @@ class ScalarEvolutionPrinterPass
explicit ScalarEvolutionPrinterPass(raw_ostream &OS) : OS(OS) {}

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

class ScalarEvolutionWrapperPass : public FunctionPass {
Expand Down
1 change: 1 addition & 0 deletions llvm/include/llvm/Analysis/StackLifetime.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class StackLifetimePrinterPass
StackLifetimePrinterPass(raw_ostream &OS, StackLifetime::LivenessType Type)
: Type(Type), OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
void printPipeline(raw_ostream &OS,
function_ref<StringRef(StringRef)> MapClassName2PassName);
};
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/StackSafetyAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class StackSafetyPrinterPass : public PassInfoMixin<StackSafetyPrinterPass> {
public:
explicit StackSafetyPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};

/// StackSafetyInfo wrapper for the legacy pass manager
Expand Down Expand Up @@ -143,6 +144,7 @@ class StackSafetyGlobalPrinterPass
public:
explicit StackSafetyGlobalPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};

/// This pass performs the global (interprocedural) stack safety analysis
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/StructuralHash.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class StructuralHashPrinterPass
: OS(OS), EnableDetailedStructuralHash(Detailed) {}

PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);

static bool isRequired() { return true; }
};

} // namespace llvm
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/Analysis/UniformityAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class UniformityInfoPrinterPass
explicit UniformityInfoPrinterPass(raw_ostream &OS);

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// Legacy analysis pass which computes a \ref CycleInfo.
Expand Down
2 changes: 2 additions & 0 deletions llvm/include/llvm/IR/Dominators.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ class DominatorTreePrinterPass
explicit DominatorTreePrinterPass(raw_ostream &OS);

PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);

static bool isRequired() { return true; }
};

/// Verifier pass for the \c DominatorTree.
Expand Down

0 comments on commit d09315d

Please sign in to comment.