diff --git a/mlir/include/mlir/Analysis/DataFlowFramework.h b/mlir/include/mlir/Analysis/DataFlowFramework.h index 969664dc7a4fe..dfd358e7017a4 100644 --- a/mlir/include/mlir/Analysis/DataFlowFramework.h +++ b/mlir/include/mlir/Analysis/DataFlowFramework.h @@ -308,6 +308,10 @@ class DataFlowConfig { /// according to their dependency relations until a fixed point is reached. /// 3. Query analysis state results from the solver. /// +/// Steps to re-run a data-flow analysis when IR changes: +/// 1. Erase all analysis states as they are no longer valid. +/// 2. Re-run the analysis using `initializeAndRun`. +/// /// TODO: Optimize the internal implementation of the solver. class DataFlowSolver { public: @@ -346,6 +350,9 @@ class DataFlowSolver { } } + // Erase all analysis states + void eraseAllStates() { analysisStates.clear(); } + /// Get a uniqued lattice anchor instance. If one is not present, it is /// created with the provided arguments. template