[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 09:07:06 PDT 2024
================
@@ -0,0 +1,109 @@
+//===- LastRunTrackingAnalysis.h - Avoid running redundant pass -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This is an analysis pass to track a set of passes that have been run, so that
+// we can avoid running a pass again if there is no change since the last run of
+// the pass.
+//
+// In this pass we track a set of passes S for each function with the following
+// transition rules:
+// 1. If pass P make changes, set S = {P}.
+// 2. If pass P doesn't make changes, set S = S + {P}.
+//
+// Before running a pass P which satisfies P(P(x)) == P(x), we check if P is in
+// S. If so, we skip this pass since we know that there will be no change.
+//
+// Notes:
+// 1. Some transform passes have parameters that may vary in the optimization
+// pipeline. We should check if parameters in current run is compatible with
----------------
aeubanks wrote:
I didn't have a specific implementation in mind, I meant that we should treat `simplifycfg<params1>` and `simplifycfg<params2>` separately just like `simplifycfg<params1>` and `instcombine`.
https://github.com/llvm/llvm-project/pull/112092
More information about the llvm-commits
mailing list