Sink all InitializePasses.h includes

This file lists every pass in LLVM, and is included by Pass.h, which is
very popular. Every time we add, remove, or rename a pass in LLVM, it
caused lots of recompilation.

I found this fact by looking at this table, which is sorted by the
number of times a file was changed over the last 100,000 git commits
multiplied by the number of object files that depend on it in the
current checkout:
  recompiles    touches affected_files  header
  342380        95      3604    llvm/include/llvm/ADT/STLExtras.h
  314730        234     1345    llvm/include/llvm/InitializePasses.h
  307036        118     2602    llvm/include/llvm/ADT/APInt.h
  213049        59      3611    llvm/include/llvm/Support/MathExtras.h
  170422        47      3626    llvm/include/llvm/Support/Compiler.h
  162225        45      3605    llvm/include/llvm/ADT/Optional.h
  158319        63      2513    llvm/include/llvm/ADT/Triple.h
  140322        39      3598    llvm/include/llvm/ADT/StringRef.h
  137647        59      2333    llvm/include/llvm/Support/Error.h
  131619        73      1803    llvm/include/llvm/Support/FileSystem.h

Before this change, touching InitializePasses.h would cause 1345 files
to recompile. After this change, touching it only causes 550 compiles in
an incremental rebuild.

Reviewers: bkramer, asbirlea, bollu, jdoerfert

Differential Revision: https://reviews.llvm.org/D70211
This commit is contained in:
Reid Kleckner
2019-11-13 13:15:01 -08:00
parent a36f316390
commit 05da2fe521
393 changed files with 597 additions and 199 deletions
@@ -40,6 +40,7 @@
#include "llvm/IR/Function.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
using namespace llvm;
+2 -7
View File
@@ -1179,14 +1179,9 @@ struct ExternalAAWrapperPass : ImmutablePass {
static char ID;
ExternalAAWrapperPass() : ImmutablePass(ID) {
initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry());
}
ExternalAAWrapperPass();
explicit ExternalAAWrapperPass(CallbackT CB)
: ImmutablePass(ID), CB(std::move(CB)) {
initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry());
}
explicit ExternalAAWrapperPass(CallbackT CB);
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll();
@@ -233,10 +233,7 @@ class BranchProbabilityInfoWrapperPass : public FunctionPass {
public:
static char ID;
BranchProbabilityInfoWrapperPass() : FunctionPass(ID) {
initializeBranchProbabilityInfoWrapperPassPass(
*PassRegistry::getPassRegistry());
}
BranchProbabilityInfoWrapperPass();
BranchProbabilityInfo &getBPI() { return BPI; }
const BranchProbabilityInfo &getBPI() const { return BPI; }
@@ -954,10 +954,7 @@ template <typename T> class ArrayRef;
class DependenceAnalysisWrapperPass : public FunctionPass {
public:
static char ID; // Class identification, replacement for typeinfo
DependenceAnalysisWrapperPass() : FunctionPass(ID) {
initializeDependenceAnalysisWrapperPassPass(
*PassRegistry::getPassRegistry());
}
DependenceAnalysisWrapperPass();
bool runOnFunction(Function &F) override;
void releaseMemory() override;
@@ -50,9 +50,7 @@ class IntervalPartition : public FunctionPass {
public:
static char ID; // Pass identification, replacement for typeid
IntervalPartition() : FunctionPass(ID) {
initializeIntervalPartitionPass(*PassRegistry::getPassRegistry());
}
IntervalPartition();
// run - Calculate the interval partition for this function
bool runOnFunction(Function &F) override;
+1 -3
View File
@@ -144,9 +144,7 @@ class LazyValueInfoWrapperPass : public FunctionPass {
void operator=(const LazyValueInfoWrapperPass&) = delete;
public:
static char ID;
LazyValueInfoWrapperPass() : FunctionPass(ID) {
initializeLazyValueInfoWrapperPassPass(*PassRegistry::getPassRegistry());
}
LazyValueInfoWrapperPass();
~LazyValueInfoWrapperPass() override {
assert(!Info.PImpl && "releaseMemory not called");
}
@@ -16,20 +16,18 @@
#define LLVM_ANALYSIS_LEGACY_DIVERGENCE_ANALYSIS_H
#include "llvm/ADT/DenseSet.h"
#include "llvm/IR/Function.h"
#include "llvm/Pass.h"
#include "llvm/Analysis/DivergenceAnalysis.h"
#include "llvm/Pass.h"
namespace llvm {
class Value;
class Function;
class GPUDivergenceAnalysis;
class LegacyDivergenceAnalysis : public FunctionPass {
public:
static char ID;
LegacyDivergenceAnalysis() : FunctionPass(ID) {
initializeLegacyDivergenceAnalysisPass(*PassRegistry::getPassRegistry());
}
LegacyDivergenceAnalysis();
void getAnalysisUsage(AnalysisUsage &AU) const override;
@@ -724,9 +724,7 @@ class LoopAccessLegacyAnalysis : public FunctionPass {
public:
static char ID;
LoopAccessLegacyAnalysis() : FunctionPass(ID) {
initializeLoopAccessLegacyAnalysisPass(*PassRegistry::getPassRegistry());
}
LoopAccessLegacyAnalysis();
bool runOnFunction(Function &F) override;
+1 -3
View File
@@ -1211,9 +1211,7 @@ class LoopInfoWrapperPass : public FunctionPass {
public:
static char ID; // Pass identification, replacement for typeid
LoopInfoWrapperPass() : FunctionPass(ID) {
initializeLoopInfoWrapperPassPass(*PassRegistry::getPassRegistry());
}
LoopInfoWrapperPass();
LoopInfo &getLoopInfo() { return LI; }
const LoopInfo &getLoopInfo() const { return LI; }
+1 -3
View File
@@ -162,9 +162,7 @@ private:
// pass manager calls lcssa verification for the current loop.
struct LCSSAVerificationPass : public FunctionPass {
static char ID;
LCSSAVerificationPass() : FunctionPass(ID) {
initializeLCSSAVerificationPassPass(*PassRegistry::getPassRegistry());
}
LCSSAVerificationPass();
bool runOnFunction(Function &F) override { return false; }
+1 -3
View File
@@ -68,9 +68,7 @@ struct PostDominatorTreeWrapperPass : public FunctionPass {
PostDominatorTree DT;
PostDominatorTreeWrapperPass() : FunctionPass(ID) {
initializePostDominatorTreeWrapperPassPass(*PassRegistry::getPassRegistry());
}
PostDominatorTreeWrapperPass();
PostDominatorTree &getPostDomTree() { return DT; }
const PostDominatorTree &getPostDomTree() const { return DT; }
@@ -220,9 +220,7 @@ class GISelCSEAnalysisWrapperPass : public MachineFunctionPass {
public:
static char ID;
GISelCSEAnalysisWrapperPass() : MachineFunctionPass(ID) {
initializeGISelCSEAnalysisWrapperPassPass(*PassRegistry::getPassRegistry());
}
GISelCSEAnalysisWrapperPass();
void getAnalysisUsage(AnalysisUsage &AU) const override;
+1
View File
@@ -17,6 +17,7 @@
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include <cassert>
#include <map>
@@ -36,6 +36,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/InitializePasses.h"
namespace llvm {
@@ -35,10 +35,7 @@ class MachineBranchProbabilityInfo : public ImmutablePass {
public:
static char ID;
MachineBranchProbabilityInfo() : ImmutablePass(ID) {
PassRegistry &Registry = *PassRegistry::getPassRegistry();
initializeMachineBranchProbabilityInfoPass(Registry);
}
MachineBranchProbabilityInfo();
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll();
+1 -3
View File
@@ -89,9 +89,7 @@ class MachineLoopInfo : public MachineFunctionPass {
public:
static char ID; // Pass identification, replacement for typeid
MachineLoopInfo() : MachineFunctionPass(ID) {
initializeMachineLoopInfoPass(*PassRegistry::getPassRegistry());
}
MachineLoopInfo();
explicit MachineLoopInfo(MachineDominatorTree &MDT)
: MachineFunctionPass(ID) {
calculate(MDT);
@@ -46,6 +46,7 @@
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/CodeGen/ScheduleDAGInstrs.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/InitializePasses.h"
namespace llvm {
@@ -25,6 +25,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/LoopTraversal.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/InitializePasses.h"
namespace llvm {
@@ -21,6 +21,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/Instructions.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include <cstdint>
#include <vector>
+2 -7
View File
@@ -347,14 +347,9 @@ class raw_ostream;
public:
static char ID;
SlotIndexes() : MachineFunctionPass(ID), mf(nullptr) {
initializeSlotIndexesPass(*PassRegistry::getPassRegistry());
}
SlotIndexes();
~SlotIndexes() override {
// The indexList's nodes are all allocated in the BumpPtrAllocator.
indexList.clearAndLeakNodesUnsafely();
}
~SlotIndexes() override;
void getAnalysisUsage(AnalysisUsage &au) const override;
void releaseMemory() override;

Some files were not shown because too many files have changed in this diff Show More