llvm.org GIT mirror llvm / 0df8905
[PM] Introduce a utility pass that preserves no analyses. Use this to test that path of invalidation. This test actually shows redundant invalidation here that is really bad. I'm going to work on fixing that next, but wanted to commit the test harness now that its all working. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225257 91177308-0d34-0410-b5e6-96231b3b80d8 Chandler Carruth 4 years ago
3 changed file(s) with 50 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
815815 static StringRef name() { return "No-op Analysis Invalidation Pass"; }
816816 };
817817
818 /// \brief A utility pass that does nothing but preserves no analyses.
819 ///
820 /// As a consequence fo not preserving any analyses, this pass will force all
821 /// analysis passes to be re-run to produce fresh results if any are needed.
822 struct InvalidateAllAnalysesPass {
823 /// \brief Run this pass over some unit of IR.
824 template
825 PreservedAnalyses run(T &&Arg) {
826 return PreservedAnalyses::none();
827 }
828
829 static StringRef name() { return "InvalidateAllAnalysesPass"; }
830 };
831
818832 }
819833
820834 #endif
193193 ; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Invalidating function analysis: NoOpFunctionAnalysis
194194 ; CHECK-DO-INVALIDATE-FUNCTION-ANALYSIS-RESULTS: Running function analysis: NoOpFunctionAnalysis
195195
196 ; RUN: opt -disable-output -disable-verify -debug-pass-manager -debug-cgscc-pass-manager \
197 ; RUN: -passes='require,cgscc(require,function(require,invalidate,require),require),require' %s 2>&1 \
198 ; RUN: | FileCheck %s --check-prefix=CHECK-INVALIDATE-ALL
199 ; CHECK-INVALIDATE-ALL: Starting module pass manager run.
200 ; CHECK-INVALIDATE-ALL: Running module pass: No-op Analysis Requirement Pass
201 ; CHECK-INVALIDATE-ALL: Running module analysis: NoOpModuleAnalysis
202 ; CHECK-INVALIDATE-ALL: Starting CGSCC pass manager run.
203 ; CHECK-INVALIDATE-ALL: Running CGSCC pass: No-op Analysis Requirement Pass
204 ; CHECK-INVALIDATE-ALL: Running CGSCC analysis: NoOpCGSCCAnalysis
205 ; CHECK-INVALIDATE-ALL: Starting function pass manager run.
206 ; CHECK-INVALIDATE-ALL: Running function pass: No-op Analysis Requirement Pass
207 ; CHECK-INVALIDATE-ALL: Running function analysis: NoOpFunctionAnalysis
208 ; CHECK-INVALIDATE-ALL: Running function pass: InvalidateAllAnalysesPass
209 ; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses for function
210 ; CHECK-INVALIDATE-ALL: Invalidating function analysis: NoOpFunctionAnalysis
211 ; CHECK-INVALIDATE-ALL: Running function pass: No-op Analysis Requirement Pass
212 ; CHECK-INVALIDATE-ALL: Running function analysis: NoOpFunctionAnalysis
213 ; CHECK-INVALIDATE-ALL: Finished function pass manager run.
214 ; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses for function
215 ; CHECK-INVALIDATE-ALL: Invalidating function analysis: NoOpFunctionAnalysis
216 ; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses for SCC
217 ; CHECK-INVALIDATE-ALL: Invalidating CGSCC analysis: NoOpCGSCCAnalysis
218 ; CHECK-INVALIDATE-ALL: Running CGSCC pass: No-op Analysis Requirement Pass
219 ; CHECK-INVALIDATE-ALL: Running CGSCC analysis: NoOpCGSCCAnalysis
220 ; CHECK-INVALIDATE-ALL: Finished CGSCC pass manager run.
221 ; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses for SCC
222 ; CHECK-INVALIDATE-ALL: Invalidating CGSCC analysis: NoOpCGSCCAnalysis
223 ; CHECK-INVALIDATE-ALL: Invalidating all non-preserved analyses for module
224 ; CHECK-INVALIDATE-ALL: Invalidating module analysis: NoOpModuleAnalysis
225 ; CHECK-INVALIDATE-ALL: Running module pass: No-op Analysis Requirement Pass
226 ; CHECK-INVALIDATE-ALL: Running module analysis: NoOpModuleAnalysis
227 ; CHECK-INVALIDATE-ALL: Finished module pass manager run.
228
196229 define void @foo() {
197230 ret void
198231 }
2525 #ifndef MODULE_PASS
2626 #define MODULE_PASS(NAME, CREATE_PASS)
2727 #endif
28 MODULE_PASS("invalidate", InvalidateAllAnalysesPass())
2829 MODULE_PASS("no-op-module", NoOpModulePass())
2930 MODULE_PASS("print", PrintModulePass(dbgs()))
3031 MODULE_PASS("print-cg", LazyCallGraphPrinterPass(dbgs()))
4041 #ifndef CGSCC_PASS
4142 #define CGSCC_PASS(NAME, CREATE_PASS)
4243 #endif
44 CGSCC_PASS("invalidate", InvalidateAllAnalysesPass())
4345 CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())
4446 #undef CGSCC_PASS
4547
5254 #ifndef FUNCTION_PASS
5355 #define FUNCTION_PASS(NAME, CREATE_PASS)
5456 #endif
57 FUNCTION_PASS("invalidate", InvalidateAllAnalysesPass())
5558 FUNCTION_PASS("no-op-function", NoOpFunctionPass())
5659 FUNCTION_PASS("print", PrintFunctionPass(dbgs()))
5760 FUNCTION_PASS("verify", VerifierPass())