#include "mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h"
#include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
#include "mlir/Analysis/DataFlow/SparseAnalysis.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Pass/Pass.h"
usingnamespacemlir;
usingnamespacemlir::dataflow;
namespace {
struct WrittenToLatticeValue { … };
struct WrittenTo : public Lattice<WrittenToLatticeValue> { … };
class WrittenToAnalysis : public SparseBackwardDataFlowAnalysis<WrittenTo> { … };
LogicalResult
WrittenToAnalysis::visitOperation(Operation *op, ArrayRef<WrittenTo *> operands,
ArrayRef<const WrittenTo *> results) { … }
void WrittenToAnalysis::visitBranchOperand(OpOperand &operand) { … }
void WrittenToAnalysis::visitCallOperand(OpOperand &operand) { … }
void WrittenToAnalysis::visitExternalCall(CallOpInterface call,
ArrayRef<WrittenTo *> operands,
ArrayRef<const WrittenTo *> results) { … }
}
namespace {
struct TestWrittenToPass
: public PassWrapper<TestWrittenToPass, OperationPass<>> { … };
}
namespace mlir {
namespace test {
void registerTestWrittenToPass() { … }
}
}