[llvm] [Analysis] Avoid running transform passes that have just been run (PR #112092)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 14:48:23 PDT 2024


================
@@ -5538,8 +5539,15 @@ void InstCombinePass::printPipeline(
   OS << '>';
 }
 
+char InstCombinePass::ID = 0;
+
 PreservedAnalyses InstCombinePass::run(Function &F,
                                        FunctionAnalysisManager &AM) {
+  auto &LRT = AM.getResult<LastRunTrackingAnalysis>(F);
+  // No changes since last InstCombine pass, exit early.
+  if (LRT.shouldSkip(&ID, Options))
+    return PreservedAnalyses::all();
----------------
aeubanks wrote:

> Is there no way to get the parameters going into a pass from the new manager?

no, I'm not sure how that would work. pass parameters are specified when constructing the pass, none of the pass manager infrastructure can access pass params because that's not really part of the public API of a pass

https://github.com/llvm/llvm-project/pull/112092


More information about the llvm-commits mailing list