Skip to content

Commit 00740da

Browse files
MaheshRavishankarnirvedhmeshram
authored andcommitted
Revert "[mlir] [dataflow] Refactoring the definition of program points in data flow analysis (llvm#105656)"
This reverts commit b6603e1.
1 parent a9ba1b6 commit 00740da

13 files changed

+204
-237
lines changed

mlir/include/mlir/Analysis/DataFlow/DeadCodeAnalysis.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ namespace dataflow {
3535
//===----------------------------------------------------------------------===//
3636

3737
/// This is a simple analysis state that represents whether the associated
38-
/// lattice anchor (either a block or a control-flow edge) is live.
38+
/// program point (either a block or a control-flow edge) is live.
3939
class Executable : public AnalysisState {
4040
public:
4141
using AnalysisState::AnalysisState;
4242

43-
/// Set the state of the lattice anchor to live.
43+
/// Set the state of the program point to live.
4444
ChangeResult setToLive();
4545

46-
/// Get whether the lattice anchor is live.
46+
/// Get whether the program point is live.
4747
bool isLive() const { return live; }
4848

4949
/// Print the liveness.
5050
void print(raw_ostream &os) const override;
5151

52-
/// When the state of the lattice anchor is changed to live, re-invoke
52+
/// When the state of the program point is changed to live, re-invoke
5353
/// subscribed analyses on the operations in the block and on the block
5454
/// itself.
5555
void onUpdate(DataFlowSolver *solver) const override;
@@ -60,8 +60,8 @@ class Executable : public AnalysisState {
6060
}
6161

6262
private:
63-
/// Whether the lattice anchor is live. Optimistically assume that the lattice
64-
/// anchor is dead.
63+
/// Whether the program point is live. Optimistically assume that the program
64+
/// point is dead.
6565
bool live = false;
6666

6767
/// A set of analyses that should be updated when this state changes.
@@ -140,10 +140,10 @@ class PredecessorState : public AnalysisState {
140140
// CFGEdge
141141
//===----------------------------------------------------------------------===//
142142

143-
/// This lattice anchor represents a control-flow edge between a block and one
143+
/// This program point represents a control-flow edge between a block and one
144144
/// of its successors.
145145
class CFGEdge
146-
: public GenericLatticeAnchorBase<CFGEdge, std::pair<Block *, Block *>> {
146+
: public GenericProgramPointBase<CFGEdge, std::pair<Block *, Block *>> {
147147
public:
148148
using Base::Base;
149149

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

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,15 @@ class AbstractDenseForwardDataFlowAnalysis : public DataFlowAnalysis {
9191
const AbstractDenseLattice &before,
9292
AbstractDenseLattice *after) = 0;
9393

94-
/// Get the dense lattice after the execution of the given lattice anchor.
95-
virtual AbstractDenseLattice *getLattice(LatticeAnchor anchor) = 0;
94+
/// Get the dense lattice after the execution of the given program point.
95+
virtual AbstractDenseLattice *getLattice(ProgramPoint point) = 0;
9696

9797
/// Get the dense lattice after the execution of the given program point and
98-
/// add it as a dependency to a lattice anchor. That is, every time the
99-
/// lattice after anchor is updated, the dependent program point must be
100-
/// visited, and the newly triggered visit might update the lattice after
101-
/// dependent.
98+
/// add it as a dependency to a program point. That is, every time the lattice
99+
/// after point is updated, the dependent program point must be visited, and
100+
/// the newly triggered visit might update the lattice after dependent.
102101
const AbstractDenseLattice *getLatticeFor(ProgramPoint dependent,
103-
LatticeAnchor anchor);
102+
ProgramPoint point);
104103

105104
/// Set the dense lattice at control flow entry point and propagate an update
106105
/// if it changed.
@@ -250,9 +249,9 @@ class DenseForwardDataFlowAnalysis
250249
}
251250

252251
protected:
253-
/// Get the dense lattice on this lattice anchor.
254-
LatticeT *getLattice(LatticeAnchor anchor) override {
255-
return getOrCreate<LatticeT>(anchor);
252+
/// Get the dense lattice after this program point.
253+
LatticeT *getLattice(ProgramPoint point) override {
254+
return getOrCreate<LatticeT>(point);
256255
}
257256

258257
/// Set the dense lattice at control flow entry point and propagate an update
@@ -332,16 +331,16 @@ class AbstractDenseBackwardDataFlowAnalysis : public DataFlowAnalysis {
332331
const AbstractDenseLattice &after,
333332
AbstractDenseLattice *before) = 0;
334333

335-
/// Get the dense lattice before the execution of the lattice anchor. That is,
334+
/// Get the dense lattice before the execution of the program point. That is,
336335
/// before the execution of the given operation or after the execution of the
337336
/// block.
338-
virtual AbstractDenseLattice *getLattice(LatticeAnchor anchor) = 0;
337+
virtual AbstractDenseLattice *getLattice(ProgramPoint point) = 0;
339338

340-
/// Get the dense lattice before the execution of the program point in
341-
/// `anchor` and declare that the `dependent` program point must be updated
342-
/// every time `point` is.
339+
/// Get the dense lattice before the execution of the program point `point`
340+
/// and declare that the `dependent` program point must be updated every time
341+
/// `point` is.
343342
const AbstractDenseLattice *getLatticeFor(ProgramPoint dependent,
344-
LatticeAnchor anchor);
343+
ProgramPoint point);
345344

346345
/// Set the dense lattice before at the control flow exit point and propagate
347346
/// the update if it changed.
@@ -501,9 +500,9 @@ class DenseBackwardDataFlowAnalysis
501500
}
502501

503502
protected:
504-
/// Get the dense lattice at the given lattice anchor.
505-
LatticeT *getLattice(LatticeAnchor anchor) override {
506-
return getOrCreate<LatticeT>(anchor);
503+
/// Get the dense lattice at the given program point.
504+
LatticeT *getLattice(ProgramPoint point) override {
505+
return getOrCreate<LatticeT>(point);
507506
}
508507

509508
/// Set the dense lattice at control flow exit point (after the terminator)

mlir/include/mlir/Analysis/DataFlow/IntegerRangeAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class IntegerRangeAnalysis
5050
/// At an entry point, we cannot reason about interger value ranges.
5151
void setToEntryState(IntegerValueRangeLattice *lattice) override {
5252
propagateIfChanged(lattice, lattice->join(IntegerValueRange::getMaxRange(
53-
lattice->getAnchor())));
53+
lattice->getPoint())));
5454
}
5555

5656
/// Visit an operation. Invoke the transfer function on each operation that

mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class AbstractSparseLattice : public AnalysisState {
3636
/// Lattices can only be created for values.
3737
AbstractSparseLattice(Value value) : AnalysisState(value) {}
3838

39-
/// Return the value this lattice is located at.
40-
Value getAnchor() const { return AnalysisState::getAnchor().get<Value>(); }
39+
/// Return the program point this lattice is located at.
40+
Value getPoint() const { return AnalysisState::getPoint().get<Value>(); }
4141

4242
/// Join the information contained in 'rhs' into this lattice. Returns
4343
/// if the value of the lattice changed.
@@ -86,8 +86,8 @@ class Lattice : public AbstractSparseLattice {
8686
public:
8787
using AbstractSparseLattice::AbstractSparseLattice;
8888

89-
/// Return the value this lattice is located at.
90-
Value getAnchor() const { return anchor.get<Value>(); }
89+
/// Return the program point this lattice is located at.
90+
Value getPoint() const { return point.get<Value>(); }
9191

9292
/// Return the value held by this lattice. This requires that the value is
9393
/// initialized.

0 commit comments

Comments
 (0)