diff options
| author | Mehdi Amini <aminim@google.com> | 2019-03-25 00:29:00 -0700 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 17:38:29 -0700 |
| commit | bb621a5596acc846b1ed6af50b483b38af71c42a (patch) | |
| tree | 7164a8fe9c3767758b266cef4a9b223e3f4e4035 /mlir | |
| parent | 63e8725bc2700f7d19cc2c5846a8f073e6123f7e (diff) | |
| download | bcm5719-llvm-bb621a5596acc846b1ed6af50b483b38af71c42a.tar.gz bcm5719-llvm-bb621a5596acc846b1ed6af50b483b38af71c42a.zip | |
Using getContext() instead of getInstruction()->getContext() on Operation (NFC)
PiperOrigin-RevId: 240088209
Diffstat (limited to 'mlir')
| -rw-r--r-- | mlir/include/mlir/IR/OpDefinition.h | 2 | ||||
| -rw-r--r-- | mlir/lib/AffineOps/AffineOps.cpp | 8 | ||||
| -rw-r--r-- | mlir/lib/Analysis/LoopAnalysis.cpp | 2 | ||||
| -rw-r--r-- | mlir/lib/StandardOps/Ops.cpp | 2 | ||||
| -rw-r--r-- | mlir/lib/Transforms/MaterializeVectors.cpp | 2 | ||||
| -rw-r--r-- | mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp | 14 |
6 files changed, 13 insertions, 17 deletions
diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h index ecf6368bb17..b03ef08f37a 100644 --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -94,7 +94,7 @@ public: state->setAttr(name, value); } void setAttr(StringRef name, Attribute value) { - setAttr(Identifier::get(name, getInstruction()->getContext()), value); + setAttr(Identifier::get(name, getContext()), value); } /// Return true if there are no users of any results of this operation. diff --git a/mlir/lib/AffineOps/AffineOps.cpp b/mlir/lib/AffineOps/AffineOps.cpp index 0c8dcb5ab56..4badde9012b 100644 --- a/mlir/lib/AffineOps/AffineOps.cpp +++ b/mlir/lib/AffineOps/AffineOps.cpp @@ -1063,7 +1063,7 @@ Block *AffineForOp::createBody() { // Create a new block for the body, and add an argument for the induction // variable. Block *body = new Block(); - body->addArgument(IndexType::get(getInstruction()->getContext())); + body->addArgument(IndexType::get(getContext())); bodyRegion.push_back(body); return body; } @@ -1139,13 +1139,11 @@ int64_t AffineForOp::getConstantUpperBound() { } void AffineForOp::setConstantLowerBound(int64_t value) { - setLowerBound( - {}, AffineMap::getConstantMap(value, getInstruction()->getContext())); + setLowerBound({}, AffineMap::getConstantMap(value, getContext())); } void AffineForOp::setConstantUpperBound(int64_t value) { - setUpperBound( - {}, AffineMap::getConstantMap(value, getInstruction()->getContext())); + setUpperBound({}, AffineMap::getConstantMap(value, getContext())); } AffineForOp::operand_range AffineForOp::getLowerBoundOperands() { diff --git a/mlir/lib/Analysis/LoopAnalysis.cpp b/mlir/lib/Analysis/LoopAnalysis.cpp index 78f8aeb978a..ba9a29177fe 100644 --- a/mlir/lib/Analysis/LoopAnalysis.cpp +++ b/mlir/lib/Analysis/LoopAnalysis.cpp @@ -244,7 +244,7 @@ static bool isContiguousAccess(Value &iv, LoadOrStoreOp memoryOp, auto layoutMap = memRefType.getAffineMaps(); // TODO(ntv): remove dependence on Builder once we support non-identity // layout map. - Builder b(memoryOp->getInstruction()->getContext()); + Builder b(memoryOp.getContext()); if (layoutMap.size() >= 2 || (layoutMap.size() == 1 && !(layoutMap[0] == diff --git a/mlir/lib/StandardOps/Ops.cpp b/mlir/lib/StandardOps/Ops.cpp index 67c51d54789..a14f3a24e82 100644 --- a/mlir/lib/StandardOps/Ops.cpp +++ b/mlir/lib/StandardOps/Ops.cpp @@ -720,7 +720,7 @@ void CmpIOp::print(OpAsmPrinter *p) { assert(predicateValue >= static_cast<int>(CmpIPredicate::FirstValidValue) && predicateValue < static_cast<int>(CmpIPredicate::NumPredicates) && "unknown predicate index"); - Builder b(getInstruction()->getContext()); + Builder b(getContext()); auto predicateStringAttr = b.getStringAttr(getPredicateNames()[predicateValue]); p->printAttribute(predicateStringAttr); diff --git a/mlir/lib/Transforms/MaterializeVectors.cpp b/mlir/lib/Transforms/MaterializeVectors.cpp index d1374e92dc8..0a7eaabbb09 100644 --- a/mlir/lib/Transforms/MaterializeVectors.cpp +++ b/mlir/lib/Transforms/MaterializeVectors.cpp @@ -454,7 +454,7 @@ static AffineMap projectedPermutationMap(VectorTransferOpTy transfer, "Shape and ratio not of the same size"); unsigned dim = 0; SmallVector<AffineExpr, 4> keep; - MLIRContext *context = transfer->getInstruction()->getContext(); + MLIRContext *context = transfer.getContext(); functional::zipApply( [&dim, &keep, context](int64_t shape, int64_t ratio) { assert(shape >= ratio && "shape dim must be greater than ratio dim"); diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp index 1cb92f5390c..8399a99bf5f 100644 --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -456,14 +456,12 @@ void OpEmitter::genAttrGetters() { // Returns the default value if not set. // TODO: this is inefficient, we are recreating the attribute for every // call. This should be set instead. - method.body() - << " if (!attr)\n" - " return " - << formatv( - attr.getConvertFromStorageCall(), - formatv(attr.getDefaultValueTemplate(), - "mlir::Builder(this->getInstruction()->getContext())")) - << ";\n"; + method.body() << " if (!attr)\n" + " return " + << formatv(attr.getConvertFromStorageCall(), + formatv(attr.getDefaultValueTemplate(), + "mlir::Builder(this->getContext())")) + << ";\n"; } method.body() << " return " << formatv(attr.getConvertFromStorageCall(), "attr") << ";\n"; |

