Skip to content

Commit 061fafb

Browse files
committed
update 'getLatticeFor' func
1 parent 6f0aa32 commit 061fafb

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ class AbstractDenseForwardDataFlowAnalysis : public DataFlowAnalysis {
104104
/// dependency. That is, every time the lattice after anchor is updated, the
105105
/// dependent program point must be visited, and the newly triggered visit
106106
/// might update the lattice on dependent.
107-
const AbstractDenseLattice *getLatticeFor(ProgramPoint *dependent,
108-
LatticeAnchor anchor);
107+
virtual const AbstractDenseLattice *getLatticeFor(ProgramPoint *dependent,
108+
LatticeAnchor anchor) = 0;
109109

110110
/// Set the dense lattice at control flow entry point and propagate an update
111111
/// if it changed.
@@ -265,6 +265,15 @@ class DenseForwardDataFlowAnalysis
265265
return getOrCreate<LatticeT>(anchor);
266266
}
267267

268+
/// Get the dense lattice on the given lattice anchor and add dependent as its
269+
/// dependency. That is, every time the lattice after anchor is updated, the
270+
/// dependent program point must be visited, and the newly triggered visit
271+
/// might update the lattice on dependent.
272+
const AbstractDenseLattice *getLatticeFor(ProgramPoint *dependent,
273+
LatticeAnchor anchor) override {
274+
return getOrCreateFor<LatticeT>(dependent, anchor);
275+
}
276+
268277
/// Set the dense lattice at control flow entry point and propagate an update
269278
/// if it changed.
270279
virtual void setToEntryState(LatticeT *lattice) = 0;
@@ -357,8 +366,8 @@ class AbstractDenseBackwardDataFlowAnalysis : public DataFlowAnalysis {
357366
/// dependency. That is, every time the lattice after anchor is updated, the
358367
/// dependent program point must be visited, and the newly triggered visit
359368
/// might update the lattice before dependent.
360-
const AbstractDenseLattice *getLatticeFor(ProgramPoint *dependent,
361-
LatticeAnchor anchor);
369+
virtual const AbstractDenseLattice *getLatticeFor(ProgramPoint *dependent,
370+
LatticeAnchor anchor) = 0;
362371

363372
/// Set the dense lattice before at the control flow exit point and propagate
364373
/// the update if it changed.
@@ -528,6 +537,15 @@ class DenseBackwardDataFlowAnalysis
528537
return getOrCreate<LatticeT>(anchor);
529538
}
530539

540+
/// Get the dense lattice on the given lattice anchor and add dependent as its
541+
/// dependency. That is, every time the lattice after anchor is updated, the
542+
/// dependent program point must be visited, and the newly triggered visit
543+
/// might update the lattice before dependent.
544+
const virtual AbstractDenseLattice *
545+
getLatticeFor(ProgramPoint *dependent, LatticeAnchor anchor) override {
546+
return getOrCreateFor<LatticeT>(dependent, anchor);
547+
}
548+
531549
/// Set the dense lattice at control flow exit point (after the terminator)
532550
/// and propagate an update if it changed.
533551
virtual void setToExitState(LatticeT *lattice) = 0;

mlir/lib/Analysis/DataFlow/DenseAnalysis.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,6 @@ void AbstractDenseForwardDataFlowAnalysis::visitRegionBranchOperation(
249249
}
250250
}
251251

252-
const AbstractDenseLattice *
253-
AbstractDenseForwardDataFlowAnalysis::getLatticeFor(ProgramPoint *dependent,
254-
LatticeAnchor anchor) {
255-
AbstractDenseLattice *state = getLattice(anchor);
256-
addDependency(state, dependent);
257-
return state;
258-
}
259-
260252
//===----------------------------------------------------------------------===//
261253
// AbstractDenseBackwardDataFlowAnalysis
262254
//===----------------------------------------------------------------------===//
@@ -473,11 +465,3 @@ void AbstractDenseBackwardDataFlowAnalysis::visitRegionBranchOperation(
473465
before);
474466
}
475467
}
476-
477-
const AbstractDenseLattice *
478-
AbstractDenseBackwardDataFlowAnalysis::getLatticeFor(ProgramPoint *dependent,
479-
LatticeAnchor anchor) {
480-
AbstractDenseLattice *state = getLattice(anchor);
481-
addDependency(state, dependent);
482-
return state;
483-
}

0 commit comments

Comments
 (0)