Skip to content

Commit

Permalink
[PM] Give slightly less horrible names to the utility pass templates for
Browse files Browse the repository at this point in the history
requiring and invalidating specific analyses. Also make their printed
names match their class names. Writing these out as prose really doesn't
make sense to me any more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225346 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chandlerc committed Jan 7, 2015
1 parent 76bdb26 commit 7372d44
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
8 changes: 4 additions & 4 deletions include/llvm/IR/PassManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ createModuleToFunctionPassAdaptor(FunctionPassT Pass) {
///
/// This is a no-op pass which simply forces a specific analysis pass's result
/// to be available when it is run.
template <typename AnalysisT> struct NoopAnalysisRequirementPass {
template <typename AnalysisT> struct RequireAnalysisPass {
/// \brief Run this pass over some unit of IR.
///
/// This pass can be run over any unit of IR and use any analysis manager
Expand All @@ -796,15 +796,15 @@ template <typename AnalysisT> struct NoopAnalysisRequirementPass {
return PreservedAnalyses::all();
}

static StringRef name() { return "No-op Analysis Requirement Pass"; }
static StringRef name() { return "RequireAnalysisPass"; }
};

/// \brief A template utility pass to force an analysis result to be
/// invalidated.
///
/// This is a no-op pass which simply forces a specific analysis result to be
/// invalidated when it is run.
template <typename AnalysisT> struct NoopAnalysisInvalidationPass {
template <typename AnalysisT> struct InvalidateAnalysisPass {
/// \brief Run this pass over some unit of IR.
///
/// This pass can be run over any unit of IR and use any analysis manager
Expand All @@ -821,7 +821,7 @@ template <typename AnalysisT> struct NoopAnalysisInvalidationPass {
return PreservedAnalyses::all();
}

static StringRef name() { return "No-op Analysis Invalidation Pass"; }
static StringRef name() { return "InvalidateAnalysisPass"; }
};

/// \brief A utility pass that does nothing but preserves no analyses.
Expand Down
46 changes: 23 additions & 23 deletions test/Other/new-pass-manager.ll
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@
; RUN: -passes='require<no-op-module>,cgscc(require<no-op-cgscc>,function(require<no-op-function>))' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-ANALYSES
; CHECK-ANALYSES: Starting module pass manager
; CHECK-ANALYSES: Running module pass: No-op Analysis Requirement Pass
; CHECK-ANALYSES: Running module pass: RequireAnalysisPass
; CHECK-ANALYSES: Running module analysis: NoOpModuleAnalysis
; CHECK-ANALYSES: Starting CGSCC pass manager
; CHECK-ANALYSES: Running CGSCC pass: No-op Analysis Requirement Pass
; CHECK-ANALYSES: Running CGSCC pass: RequireAnalysisPass
; CHECK-ANALYSES: Running CGSCC analysis: NoOpCGSCCAnalysis
; CHECK-ANALYSES: Starting function pass manager
; CHECK-ANALYSES: Running function pass: No-op Analysis Requirement Pass
; CHECK-ANALYSES: Running function pass: RequireAnalysisPass
; CHECK-ANALYSES: Running function analysis: NoOpFunctionAnalysis

; Make sure no-op passes that preserve all analyses don't even try to do any
Expand All @@ -147,15 +147,15 @@
; RUN: -passes='require<no-op-module>,require<no-op-module>,require<no-op-module>' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-DO-CACHE-MODULE-ANALYSIS-RESULTS
; CHECK-DO-CACHE-MODULE-ANALYSIS-RESULTS: Starting module pass manager
; CHECK-DO-CACHE-MODULE-ANALYSIS-RESULTS: Running module pass: No-op Analysis Requirement Pass
; CHECK-DO-CACHE-MODULE-ANALYSIS-RESULTS: Running module pass: RequireAnalysisPass
; CHECK-DO-CACHE-MODULE-ANALYSIS-RESULTS: Running module analysis: NoOpModuleAnalysis
; CHECK-DO-CACHE-MODULE-ANALYSIS-RESULTS-NOT: Running module analysis: NoOpModuleAnalysis

; RUN: opt -disable-output -debug-pass-manager -debug-cgscc-pass-manager \
; RUN: -passes='require<no-op-module>,invalidate<no-op-module>,require<no-op-module>' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS
; CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS: Starting module pass manager
; CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS: Running module pass: No-op Analysis Requirement Pass
; CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS: Running module pass: RequireAnalysisPass
; CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS: Running module analysis: NoOpModuleAnalysis
; CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS: Invalidating module analysis: NoOpModuleAnalysis
; CHECK-DO-INVALIDATE-MODULE-ANALYSIS-RESULTS: Running module analysis: NoOpModuleAnalysis
Expand All @@ -164,15 +164,15 @@
; RUN: -passes='cgscc(require<no-op-cgscc>,require<no-op-cgscc>,require<no-op-cgscc>)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-DO-CACHE-CGSCC-ANALYSIS-RESULTS
; CHECK-DO-CACHE-CGSCC-ANALYSIS-RESULTS: Starting CGSCC pass manager
; CHECK-DO-CACHE-CGSCC-ANALYSIS-RESULTS: Running CGSCC pass: No-op Analysis Requirement Pass
; CHECK-DO-CACHE-CGSCC-ANALYSIS-RESULTS: Running CGSCC pass: RequireAnalysisPass
; CHECK-DO-CACHE-CGSCC-ANALYSIS-RESULTS: Running CGSCC analysis: NoOpCGSCCAnalysis
; CHECK-DO-CACHE-CGSCC-ANALYSIS-RESULTS-NOT: Running CGSCC analysis: NoOpCGSCCAnalysis

; RUN: opt -disable-output -debug-pass-manager -debug-cgscc-pass-manager \
; RUN: -passes='cgscc(require<no-op-cgscc>,invalidate<no-op-cgscc>,require<no-op-cgscc>)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS
; CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS: Starting CGSCC pass manager
; CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS: Running CGSCC pass: No-op Analysis Requirement Pass
; CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS: Running CGSCC pass: RequireAnalysisPass
; CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS: Running CGSCC analysis: NoOpCGSCCAnalysis
; CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS: Invalidating CGSCC analysis: NoOpCGSCCAnalysis
; CHECK-DO-INVALIDATE-CGSCC-ANALYSIS-RESULTS: Running CGSCC analysis: NoOpCGSCCAnalysis
Expand All @@ -181,15 +181,15 @@
; RUN: -passes='function(require<no-op-function>,require<no-op-function>,require<no-op-function>)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-DO-CACHE-FUNCTION-ANALYSIS-RESULTS
; CHECK-DO-CACHE-FUNCTION-ANALYSIS-RESULTS: Starting function pass manager
; CHECK-DO-CACHE-FUNCTION-ANALYSIS-RESULTS: Running function pass: No-op Analysis Requirement Pass
; CHECK-DO-CACHE-FUNCTION-ANALYSIS-RESULTS: Running function pass: RequireAnalysisPass
; CHECK-DO-CACHE-FUNCTION-ANALYSIS-RESULTS: Running function analysis: NoOpFunctionAnalysis
; CHECK-DO-CACHE-FUNCTION-ANALYSIS-RESULTS-NOT: Running function analysis: NoOpFunctionAnalysis

; RUN: opt -disable-output -debug-pass-manager -debug-cgscc-pass-manager \
; RUN: -passes='function(require<no-op-function>,invalidate<no-op-function>,require<no-op-function>)' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS
; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Starting function pass manager
; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Running function pass: No-op Analysis Requirement Pass
; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Running function pass: RequireAnalysisPass
; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Running function analysis: NoOpFunctionAnalysis
; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Invalidating function analysis: NoOpFunctionAnalysis
; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Running function analysis: NoOpFunctionAnalysis
Expand All @@ -198,71 +198,71 @@
; RUN: -passes='require<no-op-module>,module(require<no-op-module>,function(require<no-op-function>,invalidate<all>,require<no-op-function>),require<no-op-module>),require<no-op-module>' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-INVALIDATE-ALL
; CHECK-INVALIDATE-ALL: Starting module pass manager run.
; CHECK-INVALIDATE-ALL: Running module pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL: Running module pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL: Running module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL: Starting module pass manager run.
; CHECK-INVALIDATE-ALL: Running module pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL: Running module pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL-NOT: Running module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL: Starting function pass manager run.
; CHECK-INVALIDATE-ALL: Running function pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL: Running function pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL: Running function analysis: NoOpFunctionAnalysis
; CHECK-INVALIDATE-ALL: Running function pass: InvalidateAllAnalysesPass
; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses for function
; CHECK-INVALIDATE-ALL: Invalidating function analysis: NoOpFunctionAnalysis
; CHECK-INVALIDATE-ALL: Running function pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL: Running function pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL: Running function analysis: NoOpFunctionAnalysis
; CHECK-INVALIDATE-ALL: Finished function pass manager run.
; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses for function
; CHECK-INVALIDATE-ALL-NOT: Running function analysis: NoOpFunctionAnalysis
; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses for module
; CHECK-INVALIDATE-ALL: Invalidating module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL: Running module pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL: Running module pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL: Running module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL: Finished module pass manager run.
; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses for module
; CHECK-INVALIDATE-ALL-NOT: Invalidating module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL: Running module pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL: Running module pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL-NOT: Running module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL: Finished module pass manager run.

; RUN: opt -disable-output -disable-verify -debug-pass-manager -debug-cgscc-pass-manager \
; RUN: -passes='require<no-op-module>,module(require<no-op-module>,cgscc(require<no-op-cgscc>,function(require<no-op-function>,invalidate<all>,require<no-op-function>),require<no-op-cgscc>),require<no-op-module>),require<no-op-module>' %s 2>&1 \
; RUN: | FileCheck %s --check-prefix=CHECK-INVALIDATE-ALL-CG
; CHECK-INVALIDATE-ALL-CG: Starting module pass manager run.
; CHECK-INVALIDATE-ALL-CG: Running module pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL-CG: Running module pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL-CG: Running module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL-CG: Starting module pass manager run.
; CHECK-INVALIDATE-ALL-CG: Running module pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL-CG: Running module pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL-CG-NOT: Running module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL-CG: Starting CGSCC pass manager run.
; CHECK-INVALIDATE-ALL-CG: Running CGSCC pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL-CG: Running CGSCC pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL-CG: Running CGSCC analysis: NoOpCGSCCAnalysis
; CHECK-INVALIDATE-ALL-CG: Starting function pass manager run.
; CHECK-INVALIDATE-ALL-CG: Running function pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL-CG: Running function pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL-CG: Running function analysis: NoOpFunctionAnalysis
; CHECK-INVALIDATE-ALL-CG: Running function pass: InvalidateAllAnalysesPass
; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses for function
; CHECK-INVALIDATE-ALL-CG: Invalidating function analysis: NoOpFunctionAnalysis
; CHECK-INVALIDATE-ALL-CG: Running function pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL-CG: Running function pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL-CG: Running function analysis: NoOpFunctionAnalysis
; CHECK-INVALIDATE-ALL-CG: Finished function pass manager run.
; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses for function
; CHECK-INVALIDATE-ALL-CG-NOT: Running function analysis: NoOpFunctionAnalysis
; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses for SCC
; CHECK-INVALIDATE-ALL-CG: Invalidating CGSCC analysis: NoOpCGSCCAnalysis
; CHECK-INVALIDATE-ALL-CG: Running CGSCC pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL-CG: Running CGSCC pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL-CG: Running CGSCC analysis: NoOpCGSCCAnalysis
; CHECK-INVALIDATE-ALL-CG: Finished CGSCC pass manager run.
; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses for SCC
; CHECK-INVALIDATE-ALL-CG-NOT: Invalidating CGSCC analysis: NoOpCGSCCAnalysis
; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses for module
; CHECK-INVALIDATE-ALL-CG: Invalidating module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL-CG: Running module pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL-CG: Running module pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL-CG: Running module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL-CG: Finished module pass manager run.
; CHECK-INVALIDATE-ALL-CG: Invalidating all non-preserved analyses for module
; CHECK-INVALIDATE-ALL-CG-NOT: Invalidating module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL-CG: Running module pass: No-op Analysis Requirement Pass
; CHECK-INVALIDATE-ALL-CG: Running module pass: RequireAnalysisPass
; CHECK-INVALIDATE-ALL-CG-NOT: Running module analysis: NoOpModuleAnalysis
; CHECK-INVALIDATE-ALL-CG: Finished module pass manager run.

Expand Down
12 changes: 6 additions & 6 deletions tools/opt/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ static bool parseModulePassName(ModulePassManager &MPM, StringRef Name) {
}
#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
if (Name == "require<" NAME ">") { \
MPM.addPass(NoopAnalysisRequirementPass<decltype(CREATE_PASS)>()); \
MPM.addPass(RequireAnalysisPass<decltype(CREATE_PASS)>()); \
return true; \
} \
if (Name == "invalidate<" NAME ">") { \
MPM.addPass(NoopAnalysisInvalidationPass<decltype(CREATE_PASS)>()); \
MPM.addPass(InvalidateAnalysisPass<decltype(CREATE_PASS)>()); \
return true; \
}
#include "PassRegistry.def"
Expand All @@ -162,11 +162,11 @@ static bool parseCGSCCPassName(CGSCCPassManager &CGPM, StringRef Name) {
}
#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
if (Name == "require<" NAME ">") { \
CGPM.addPass(NoopAnalysisRequirementPass<decltype(CREATE_PASS)>()); \
CGPM.addPass(RequireAnalysisPass<decltype(CREATE_PASS)>()); \
return true; \
} \
if (Name == "invalidate<" NAME ">") { \
CGPM.addPass(NoopAnalysisInvalidationPass<decltype(CREATE_PASS)>()); \
CGPM.addPass(InvalidateAnalysisPass<decltype(CREATE_PASS)>()); \
return true; \
}
#include "PassRegistry.def"
Expand All @@ -182,11 +182,11 @@ static bool parseFunctionPassName(FunctionPassManager &FPM, StringRef Name) {
}
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
if (Name == "require<" NAME ">") { \
FPM.addPass(NoopAnalysisRequirementPass<decltype(CREATE_PASS)>()); \
FPM.addPass(RequireAnalysisPass<decltype(CREATE_PASS)>()); \
return true; \
} \
if (Name == "invalidate<" NAME ">") { \
FPM.addPass(NoopAnalysisInvalidationPass<decltype(CREATE_PASS)>()); \
FPM.addPass(InvalidateAnalysisPass<decltype(CREATE_PASS)>()); \
return true; \
}
#include "PassRegistry.def"
Expand Down

0 comments on commit 7372d44

Please sign in to comment.