summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Analysis')
-rw-r--r--mlir/lib/Analysis/AffineAnalysis.cpp14
-rw-r--r--mlir/lib/Analysis/AffineStructures.cpp2
-rw-r--r--mlir/lib/Analysis/LoopAnalysis.cpp14
-rw-r--r--mlir/lib/Analysis/MLFunctionMatcher.cpp4
-rw-r--r--mlir/lib/Analysis/MemRefBoundCheck.cpp4
-rw-r--r--mlir/lib/Analysis/MemRefDependenceCheck.cpp10
-rw-r--r--mlir/lib/Analysis/OpStats.cpp4
-rw-r--r--mlir/lib/Analysis/SliceAnalysis.cpp6
-rw-r--r--mlir/lib/Analysis/Utils.cpp6
-rw-r--r--mlir/lib/Analysis/VectorAnalysis.cpp6
-rw-r--r--mlir/lib/Analysis/Verifier.cpp24
11 files changed, 47 insertions, 47 deletions
diff --git a/mlir/lib/Analysis/AffineAnalysis.cpp b/mlir/lib/Analysis/AffineAnalysis.cpp
index 78115b974a1..f3fde8bb95f 100644
--- a/mlir/lib/Analysis/AffineAnalysis.cpp
+++ b/mlir/lib/Analysis/AffineAnalysis.cpp
@@ -478,14 +478,14 @@ bool mlir::getFlattenedAffineExprs(
localVarCst);
}
-/// Returns the sequence of AffineApplyOp OperationStmts operation in
+/// Returns the sequence of AffineApplyOp OperationInsts operation in
/// 'affineApplyOps', which are reachable via a search starting from 'operands',
/// and ending at operands which are not defined by AffineApplyOps.
// TODO(andydavis) Add a method to AffineApplyOp which forward substitutes
// the AffineApplyOp into any user AffineApplyOps.
void mlir::getReachableAffineApplyOps(
ArrayRef<Value *> operands,
- SmallVectorImpl<OperationStmt *> &affineApplyOps) {
+ SmallVectorImpl<OperationInst *> &affineApplyOps) {
struct State {
// The ssa value for this node in the DFS traversal.
Value *value;
@@ -499,9 +499,9 @@ void mlir::getReachableAffineApplyOps(
while (!worklist.empty()) {
State &state = worklist.back();
- auto *opStmt = state.value->getDefiningStmt();
- // Note: getDefiningStmt will return nullptr if the operand is not an
- // OperationStmt (i.e. ForStmt), which is a terminator for the search.
+ auto *opStmt = state.value->getDefiningInst();
+ // Note: getDefiningInst will return nullptr if the operand is not an
+ // OperationInst (i.e. ForStmt), which is a terminator for the search.
if (opStmt == nullptr || !opStmt->isa<AffineApplyOp>()) {
worklist.pop_back();
continue;
@@ -531,7 +531,7 @@ void mlir::getReachableAffineApplyOps(
// operands of 'valueMap'.
void mlir::forwardSubstituteReachableOps(AffineValueMap *valueMap) {
// Gather AffineApplyOps reachable from 'indices'.
- SmallVector<OperationStmt *, 4> affineApplyOps;
+ SmallVector<OperationInst *, 4> affineApplyOps;
getReachableAffineApplyOps(valueMap->getOperands(), affineApplyOps);
// Compose AffineApplyOps in 'affineApplyOps'.
for (auto *opStmt : affineApplyOps) {
@@ -842,7 +842,7 @@ addMemRefAccessConstraints(const AffineValueMap &srcAccessMap,
auto *symbol = operands[i];
assert(symbol->isValidSymbol());
// Check if the symbol is a constant.
- if (auto *opStmt = symbol->getDefiningStmt()) {
+ if (auto *opStmt = symbol->getDefiningInst()) {
if (auto constOp = opStmt->dyn_cast<ConstantIndexOp>()) {
dependenceDomain->setIdToConstant(valuePosMap.getSymPos(symbol),
constOp->getValue());
diff --git a/mlir/lib/Analysis/AffineStructures.cpp b/mlir/lib/Analysis/AffineStructures.cpp
index bfdaceff7e7..dd564df3017 100644
--- a/mlir/lib/Analysis/AffineStructures.cpp
+++ b/mlir/lib/Analysis/AffineStructures.cpp
@@ -1269,7 +1269,7 @@ bool FlatAffineConstraints::addForStmtDomain(const ForStmt &forStmt) {
addSymbolId(getNumSymbolIds(), const_cast<Value *>(operand));
loc = getNumDimIds() + getNumSymbolIds() - 1;
// Check if the symbol is a constant.
- if (auto *opStmt = operand->getDefiningStmt()) {
+ if (auto *opStmt = operand->getDefiningInst()) {
if (auto constOp = opStmt->dyn_cast<ConstantIndexOp>()) {
setIdToConstant(*operand, constOp->getValue());
}
diff --git a/mlir/lib/Analysis/LoopAnalysis.cpp b/mlir/lib/Analysis/LoopAnalysis.cpp
index 7213ba5986a..85af39222c4 100644
--- a/mlir/lib/Analysis/LoopAnalysis.cpp
+++ b/mlir/lib/Analysis/LoopAnalysis.cpp
@@ -127,7 +127,7 @@ uint64_t mlir::getLargestDivisorOfTripCount(const ForStmt &forStmt) {
bool mlir::isAccessInvariant(const Value &iv, const Value &index) {
assert(isa<ForStmt>(iv) && "iv must be a ForStmt");
assert(index.getType().isa<IndexType>() && "index must be of IndexType");
- SmallVector<OperationStmt *, 4> affineApplyOps;
+ SmallVector<OperationInst *, 4> affineApplyOps;
getReachableAffineApplyOps({const_cast<Value *>(&index)}, affineApplyOps);
if (affineApplyOps.empty()) {
@@ -234,13 +234,13 @@ static bool isVectorElement(LoadOrStoreOpPointer memoryOp) {
}
static bool isVectorTransferReadOrWrite(const Statement &stmt) {
- const auto *opStmt = cast<OperationStmt>(&stmt);
+ const auto *opStmt = cast<OperationInst>(&stmt);
return opStmt->isa<VectorTransferReadOp>() ||
opStmt->isa<VectorTransferWriteOp>();
}
using VectorizableStmtFun =
- std::function<bool(const ForStmt &, const OperationStmt &)>;
+ std::function<bool(const ForStmt &, const OperationInst &)>;
static bool isVectorizableLoopWithCond(const ForStmt &loop,
VectorizableStmtFun isVectorizableStmt) {
@@ -265,7 +265,7 @@ static bool isVectorizableLoopWithCond(const ForStmt &loop,
auto loadAndStores = matcher::Op(matcher::isLoadOrStore);
auto loadAndStoresMatched = loadAndStores.match(forStmt);
for (auto ls : loadAndStoresMatched) {
- auto *op = cast<OperationStmt>(ls.first);
+ auto *op = cast<OperationInst>(ls.first);
auto load = op->dyn_cast<LoadOp>();
auto store = op->dyn_cast<StoreOp>();
// Only scalar types are considered vectorizable, all load/store must be
@@ -285,7 +285,7 @@ static bool isVectorizableLoopWithCond(const ForStmt &loop,
bool mlir::isVectorizableLoopAlongFastestVaryingMemRefDim(
const ForStmt &loop, unsigned fastestVaryingDim) {
VectorizableStmtFun fun(
- [fastestVaryingDim](const ForStmt &loop, const OperationStmt &op) {
+ [fastestVaryingDim](const ForStmt &loop, const OperationInst &op) {
auto load = op.dyn_cast<LoadOp>();
auto store = op.dyn_cast<StoreOp>();
return load ? isContiguousAccess(loop, *load, fastestVaryingDim)
@@ -297,7 +297,7 @@ bool mlir::isVectorizableLoopAlongFastestVaryingMemRefDim(
bool mlir::isVectorizableLoop(const ForStmt &loop) {
VectorizableStmtFun fun(
// TODO: implement me
- [](const ForStmt &loop, const OperationStmt &op) { return true; });
+ [](const ForStmt &loop, const OperationInst &op) { return true; });
return isVectorizableLoopWithCond(loop, fun);
}
@@ -314,7 +314,7 @@ bool mlir::isStmtwiseShiftValid(const ForStmt &forStmt,
for (const auto &stmt : *forBody) {
// A for or if stmt does not produce any def/results (that are used
// outside).
- if (const auto *opStmt = dyn_cast<OperationStmt>(&stmt)) {
+ if (const auto *opStmt = dyn_cast<OperationInst>(&stmt)) {
for (unsigned i = 0, e = opStmt->getNumResults(); i < e; ++i) {
const Value *result = opStmt->getResult(i);
for (const StmtOperand &use : result->getUses()) {
diff --git a/mlir/lib/Analysis/MLFunctionMatcher.cpp b/mlir/lib/Analysis/MLFunctionMatcher.cpp
index c227aa3fcdd..c03fed5986b 100644
--- a/mlir/lib/Analysis/MLFunctionMatcher.cpp
+++ b/mlir/lib/Analysis/MLFunctionMatcher.cpp
@@ -200,7 +200,7 @@ namespace mlir {
namespace matcher {
MLFunctionMatcher Op(FilterFunctionType filter) {
- return MLFunctionMatcher(Statement::Kind::Operation, {}, filter);
+ return MLFunctionMatcher(Statement::Kind::OperationInst, {}, filter);
}
MLFunctionMatcher If(MLFunctionMatcher child) {
@@ -246,7 +246,7 @@ bool isReductionLoop(const Statement &stmt) {
};
bool isLoadOrStore(const Statement &stmt) {
- const auto *opStmt = dyn_cast<OperationStmt>(&stmt);
+ const auto *opStmt = dyn_cast<OperationInst>(&stmt);
return opStmt && (opStmt->isa<LoadOp>() || opStmt->isa<StoreOp>());
};
diff --git a/mlir/lib/Analysis/MemRefBoundCheck.cpp b/mlir/lib/Analysis/MemRefBoundCheck.cpp
index 995bb466fef..1cb039fe00e 100644
--- a/mlir/lib/Analysis/MemRefBoundCheck.cpp
+++ b/mlir/lib/Analysis/MemRefBoundCheck.cpp
@@ -45,7 +45,7 @@ struct MemRefBoundCheck : public FunctionPass, StmtWalker<MemRefBoundCheck> {
// Not applicable to CFG functions.
PassResult runOnCFGFunction(CFGFunction *f) override { return success(); }
- void visitOperationStmt(OperationStmt *opStmt);
+ void visitOperationInst(OperationInst *opStmt);
static char passID;
};
@@ -58,7 +58,7 @@ FunctionPass *mlir::createMemRefBoundCheckPass() {
return new MemRefBoundCheck();
}
-void MemRefBoundCheck::visitOperationStmt(OperationStmt *opStmt) {
+void MemRefBoundCheck::visitOperationInst(OperationInst *opStmt) {
if (auto loadOp = opStmt->dyn_cast<LoadOp>()) {
boundCheckLoadOrStoreOp(loadOp);
} else if (auto storeOp = opStmt->dyn_cast<StoreOp>()) {
diff --git a/mlir/lib/Analysis/MemRefDependenceCheck.cpp b/mlir/lib/Analysis/MemRefDependenceCheck.cpp
index 7c57a66310a..ec33c619a17 100644
--- a/mlir/lib/Analysis/MemRefDependenceCheck.cpp
+++ b/mlir/lib/Analysis/MemRefDependenceCheck.cpp
@@ -40,7 +40,7 @@ namespace {
/// Checks dependences between all pairs of memref accesses in an MLFunction.
struct MemRefDependenceCheck : public FunctionPass,
StmtWalker<MemRefDependenceCheck> {
- SmallVector<OperationStmt *, 4> loadsAndStores;
+ SmallVector<OperationInst *, 4> loadsAndStores;
explicit MemRefDependenceCheck()
: FunctionPass(&MemRefDependenceCheck::passID) {}
@@ -48,7 +48,7 @@ struct MemRefDependenceCheck : public FunctionPass,
// Not applicable to CFG functions.
PassResult runOnCFGFunction(CFGFunction *f) override { return success(); }
- void visitOperationStmt(OperationStmt *opStmt) {
+ void visitOperationInst(OperationInst *opStmt) {
if (opStmt->isa<LoadOp>() || opStmt->isa<StoreOp>()) {
loadsAndStores.push_back(opStmt);
}
@@ -66,7 +66,7 @@ FunctionPass *mlir::createMemRefDependenceCheckPass() {
// Adds memref access indices 'opIndices' from 'memrefType' to 'access'.
static void addMemRefAccessIndices(
- llvm::iterator_range<Operation::const_operand_iterator> opIndices,
+ llvm::iterator_range<OperationInst::const_operand_iterator> opIndices,
MemRefType memrefType, MemRefAccess *access) {
access->indices.reserve(memrefType.getRank());
for (auto *index : opIndices) {
@@ -75,7 +75,7 @@ static void addMemRefAccessIndices(
}
// Populates 'access' with memref, indices and opstmt from 'loadOrStoreOpStmt'.
-static void getMemRefAccess(const OperationStmt *loadOrStoreOpStmt,
+static void getMemRefAccess(const OperationInst *loadOrStoreOpStmt,
MemRefAccess *access) {
access->opStmt = loadOrStoreOpStmt;
if (auto loadOp = loadOrStoreOpStmt->dyn_cast<LoadOp>()) {
@@ -131,7 +131,7 @@ getDirectionVectorStr(bool ret, unsigned numCommonLoops, unsigned loopNestDepth,
// "source" access and all subsequent "destination" accesses in
// 'loadsAndStores'. Emits the result of the dependence check as a note with
// the source access.
-static void checkDependences(ArrayRef<OperationStmt *> loadsAndStores) {
+static void checkDependences(ArrayRef<OperationInst *> loadsAndStores) {
for (unsigned i = 0, e = loadsAndStores.size(); i < e; ++i) {
auto *srcOpStmt = loadsAndStores[i];
MemRefAccess srcAccess;
diff --git a/mlir/lib/Analysis/OpStats.cpp b/mlir/lib/Analysis/OpStats.cpp
index d9a0edd6d83..cea0c087297 100644
--- a/mlir/lib/Analysis/OpStats.cpp
+++ b/mlir/lib/Analysis/OpStats.cpp
@@ -38,7 +38,7 @@ struct PrintOpStatsPass : public FunctionPass, StmtWalker<PrintOpStatsPass> {
// Process ML functions and operation statments in ML functions.
PassResult runOnMLFunction(MLFunction *function) override;
- void visitOperationStmt(OperationStmt *stmt);
+ void visitOperationInst(OperationInst *stmt);
// Print summary of op stats.
void printSummary();
@@ -69,7 +69,7 @@ PassResult PrintOpStatsPass::runOnCFGFunction(CFGFunction *function) {
return success();
}
-void PrintOpStatsPass::visitOperationStmt(OperationStmt *stmt) {
+void PrintOpStatsPass::visitOperationInst(OperationInst *stmt) {
++opCount[stmt->getName().getStringRef()];
}
diff --git a/mlir/lib/Analysis/SliceAnalysis.cpp b/mlir/lib/Analysis/SliceAnalysis.cpp
index b7873f8327f..c06bf4df61e 100644
--- a/mlir/lib/Analysis/SliceAnalysis.cpp
+++ b/mlir/lib/Analysis/SliceAnalysis.cpp
@@ -52,7 +52,7 @@ void mlir::getForwardSlice(Statement *stmt,
return;
}
- if (auto *opStmt = dyn_cast<OperationStmt>(stmt)) {
+ if (auto *opStmt = dyn_cast<OperationInst>(stmt)) {
assert(opStmt->getNumResults() <= 1 && "NYI: multiple results");
if (opStmt->getNumResults() > 0) {
for (auto &u : opStmt->getResult(0)->getUses()) {
@@ -102,7 +102,7 @@ void mlir::getBackwardSlice(Statement *stmt,
}
for (auto *operand : stmt->getOperands()) {
- auto *stmt = operand->getDefiningStmt();
+ auto *stmt = operand->getDefiningInst();
if (backwardSlice->count(stmt) == 0) {
getBackwardSlice(stmt, backwardSlice, filter,
/*topLevel=*/false);
@@ -156,7 +156,7 @@ struct DFSState {
} // namespace
static void DFSPostorder(Statement *current, DFSState *state) {
- auto *opStmt = cast<OperationStmt>(current);
+ auto *opStmt = cast<OperationInst>(current);
assert(opStmt->getNumResults() <= 1 && "NYI: multi-result");
if (opStmt->getNumResults() > 0) {
for (auto &u : opStmt->getResult(0)->getUses()) {
diff --git a/mlir/lib/Analysis/Utils.cpp b/mlir/lib/Analysis/Utils.cpp
index e6975ac5d09..a63723b333c 100644
--- a/mlir/lib/Analysis/Utils.cpp
+++ b/mlir/lib/Analysis/Utils.cpp
@@ -145,7 +145,7 @@ Optional<int64_t> MemRefRegion::getBoundingConstantSizeAndShape(
//
// TODO(bondhugula): extend this to any other memref dereferencing ops
// (dma_start, dma_wait).
-bool mlir::getMemRefRegion(OperationStmt *opStmt, unsigned loopDepth,
+bool mlir::getMemRefRegion(OperationInst *opStmt, unsigned loopDepth,
MemRefRegion *region) {
OpPointer<LoadOp> loadOp;
OpPointer<StoreOp> storeOp;
@@ -204,7 +204,7 @@ bool mlir::getMemRefRegion(OperationStmt *opStmt, unsigned loopDepth,
auto *symbol = accessValueMap.getOperand(i);
assert(symbol->isValidSymbol());
// Check if the symbol is a constant.
- if (auto *opStmt = symbol->getDefiningStmt()) {
+ if (auto *opStmt = symbol->getDefiningInst()) {
if (auto constOp = opStmt->dyn_cast<ConstantIndexOp>()) {
regionCst->setIdToConstant(*symbol, constOp->getValue());
}
@@ -282,7 +282,7 @@ bool mlir::boundCheckLoadOrStoreOp(LoadOrStoreOpPointer loadOrStoreOp,
std::is_same<LoadOrStoreOpPointer, OpPointer<StoreOp>>::value,
"function argument should be either a LoadOp or a StoreOp");
- OperationStmt *opStmt = cast<OperationStmt>(loadOrStoreOp->getOperation());
+ OperationInst *opStmt = cast<OperationInst>(loadOrStoreOp->getOperation());
MemRefRegion region;
if (!getMemRefRegion(opStmt, /*loopDepth=*/0, &region))
return false;
diff --git a/mlir/lib/Analysis/VectorAnalysis.cpp b/mlir/lib/Analysis/VectorAnalysis.cpp
index ec19194f2fa..cd9451cd5e9 100644
--- a/mlir/lib/Analysis/VectorAnalysis.cpp
+++ b/mlir/lib/Analysis/VectorAnalysis.cpp
@@ -104,7 +104,7 @@ Optional<SmallVector<unsigned, 4>> mlir::shapeRatio(VectorType superVectorType,
/// header file.
static AffineMap makePermutationMap(
MLIRContext *context,
- llvm::iterator_range<Operation::operand_iterator> indices,
+ llvm::iterator_range<OperationInst::operand_iterator> indices,
const DenseMap<ForStmt *, unsigned> &enclosingLoopToVectorDim) {
using functional::makePtrDynCaster;
using functional::map;
@@ -157,7 +157,7 @@ static SetVector<ForStmt *> getEnclosingForStmts(Statement *stmt) {
}
AffineMap
-mlir::makePermutationMap(OperationStmt *opStmt,
+mlir::makePermutationMap(OperationInst *opStmt,
const DenseMap<ForStmt *, unsigned> &loopToVectorDim) {
DenseMap<ForStmt *, unsigned> enclosingLoopToVectorDim;
auto enclosingLoops = getEnclosingForStmts(opStmt);
@@ -178,7 +178,7 @@ mlir::makePermutationMap(OperationStmt *opStmt,
enclosingLoopToVectorDim);
}
-bool mlir::matcher::operatesOnStrictSuperVectors(const OperationStmt &opStmt,
+bool mlir::matcher::operatesOnStrictSuperVectors(const OperationInst &opStmt,
VectorType subVectorType) {
// First, extract the vector type and ditinguish between:
// a. ops that *must* lower a super-vector (i.e. vector_transfer_read,
diff --git a/mlir/lib/Analysis/Verifier.cpp b/mlir/lib/Analysis/Verifier.cpp
index e7abb899a11..e1de6191de6 100644
--- a/mlir/lib/Analysis/Verifier.cpp
+++ b/mlir/lib/Analysis/Verifier.cpp
@@ -51,7 +51,7 @@ namespace {
///
class Verifier {
public:
- bool failure(const Twine &message, const Operation &value) {
+ bool failure(const Twine &message, const OperationInst &value) {
return value.emitError(message);
}
@@ -62,15 +62,15 @@ public:
bool failure(const Twine &message, const BasicBlock &bb) {
// Take the location information for the first instruction in the block.
if (!bb.empty())
- if (auto *op = dyn_cast<OperationStmt>(&bb.front()))
+ if (auto *op = dyn_cast<OperationInst>(&bb.front()))
return failure(message, *op);
// Worst case, fall back to using the function's location.
return failure(message, fn);
}
- bool verifyOperation(const Operation &op);
- bool verifyAttribute(Attribute attr, const Operation &op);
+ bool verifyOperation(const OperationInst &op);
+ bool verifyAttribute(Attribute attr, const OperationInst &op);
protected:
explicit Verifier(const Function &fn) : fn(fn) {}
@@ -82,7 +82,7 @@ private:
} // end anonymous namespace
// Check that function attributes are all well formed.
-bool Verifier::verifyAttribute(Attribute attr, const Operation &op) {
+bool Verifier::verifyAttribute(Attribute attr, const OperationInst &op) {
if (!attr.isOrContainsFunction())
return false;
@@ -109,9 +109,9 @@ bool Verifier::verifyAttribute(Attribute attr, const Operation &op) {
return false;
}
-/// Check the invariants of the specified operation instruction or statement.
-bool Verifier::verifyOperation(const Operation &op) {
- if (op.getOperationFunction() != &fn)
+/// Check the invariants of the specified operation.
+bool Verifier::verifyOperation(const OperationInst &op) {
+ if (op.getFunction() != &fn)
return failure("operation in the wrong function", op);
// Check that operands are non-nil and structurally ok.
@@ -245,7 +245,7 @@ struct MLFuncVerifier : public Verifier, public StmtWalker<MLFuncVerifier> {
MLFuncVerifier(const MLFunction &fn) : Verifier(fn), fn(fn) {}
- void visitOperationStmt(OperationStmt *opStmt) {
+ void visitOperationInst(OperationInst *opStmt) {
hadError |= verifyOperation(*opStmt);
}
@@ -302,14 +302,14 @@ bool MLFuncVerifier::verifyDominance() {
if (!liveValues.count(opValue)) {
stmt.emitError("operand #" + Twine(operandNo) +
" does not dominate this use");
- if (auto *useStmt = opValue->getDefiningStmt())
+ if (auto *useStmt = opValue->getDefiningInst())
useStmt->emitNote("operand defined here");
return true;
}
++operandNo;
}
- if (auto *opStmt = dyn_cast<OperationStmt>(&stmt)) {
+ if (auto *opStmt = dyn_cast<OperationInst>(&stmt)) {
// Operations define values, add them to the hash table.
for (auto *result : opStmt->getResults())
liveValues.insert(result, true);
@@ -344,7 +344,7 @@ bool MLFuncVerifier::verifyReturn() {
return failure(missingReturnMsg, fn);
const auto &stmt = fn.getBody()->getStatements().back();
- if (const auto *op = dyn_cast<OperationStmt>(&stmt)) {
+ if (const auto *op = dyn_cast<OperationInst>(&stmt)) {
if (!op->isReturn())
return failure(missingReturnMsg, fn);
OpenPOWER on IntegriCloud