summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2020-01-11 08:54:04 -0800
committerRiver Riddle <riverriddle@google.com>2020-01-11 08:54:39 -0800
commit2bdf33cc4c733342fc83081bc7410ac5e9a24f55 (patch)
tree3306d769c2bbabda1060928e0cea79d021ea9da2 /mlir/lib/IR
parent1d641daf260308815d014d1bf1b424a1ed1e7277 (diff)
downloadbcm5719-llvm-2bdf33cc4c733342fc83081bc7410ac5e9a24f55.tar.gz
bcm5719-llvm-2bdf33cc4c733342fc83081bc7410ac5e9a24f55.zip
[mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is properly value-typed.
Summary: These were temporary methods used to simplify the transition. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D72548
Diffstat (limited to 'mlir/lib/IR')
-rw-r--r--mlir/lib/IR/AsmPrinter.cpp16
-rw-r--r--mlir/lib/IR/Block.cpp2
-rw-r--r--mlir/lib/IR/Builders.cpp2
-rw-r--r--mlir/lib/IR/Function.cpp4
-rw-r--r--mlir/lib/IR/Operation.cpp24
-rw-r--r--mlir/lib/IR/PatternMatch.cpp2
-rw-r--r--mlir/lib/IR/Region.cpp4
-rw-r--r--mlir/lib/IR/TypeUtilities.cpp6
-rw-r--r--mlir/lib/IR/Value.cpp6
9 files changed, 33 insertions, 33 deletions
diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index 6c58d74e2ee..53ded9d7268 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -405,7 +405,7 @@ void AliasState::visitOperation(Operation *op) {
for (auto &region : op->getRegions())
for (auto &block : region)
for (auto arg : block.getArguments())
- visitType(arg->getType());
+ visitType(arg.getType());
// Visit each of the attributes.
for (auto elt : op->getAttrs())
@@ -615,7 +615,7 @@ void SSANameState::numberValuesInBlock(
DialectInterfaceCollection<OpAsmDialectInterface> &interfaces) {
auto setArgNameFn = [&](Value arg, StringRef name) {
assert(!valueIDs.count(arg) && "arg numbered multiple times");
- assert(arg.cast<BlockArgument>()->getOwner() == &block &&
+ assert(arg.cast<BlockArgument>().getOwner() == &block &&
"arg not defined in 'block'");
setValueName(arg, name);
};
@@ -659,11 +659,11 @@ void SSANameState::numberValuesInOp(
SmallVector<int, 2> resultGroups(/*Size=*/1, /*Value=*/0);
auto setResultNameFn = [&](Value result, StringRef name) {
assert(!valueIDs.count(result) && "result numbered multiple times");
- assert(result->getDefiningOp() == &op && "result not defined by 'op'");
+ assert(result.getDefiningOp() == &op && "result not defined by 'op'");
setValueName(result, name);
// Record the result number for groups not anchored at 0.
- if (int resultNo = result.cast<OpResult>()->getResultNumber())
+ if (int resultNo = result.cast<OpResult>().getResultNumber())
resultGroups.push_back(resultNo);
};
if (OpAsmOpInterface asmInterface = dyn_cast<OpAsmOpInterface>(&op))
@@ -684,10 +684,10 @@ void SSANameState::numberValuesInOp(
void SSANameState::getResultIDAndNumber(OpResult result, Value &lookupValue,
Optional<int> &lookupResultNo) const {
- Operation *owner = result->getOwner();
+ Operation *owner = result.getOwner();
if (owner->getNumResults() == 1)
return;
- int resultNo = result->getResultNumber();
+ int resultNo = result.getResultNumber();
// If this operation has multiple result groups, we will need to find the
// one corresponding to this result.
@@ -2009,7 +2009,7 @@ void OperationPrinter::print(Block *block, bool printBlockArgs,
interleaveComma(block->getArguments(), [&](BlockArgument arg) {
printValueID(arg);
os << ": ";
- printType(arg->getType());
+ printType(arg.getType());
});
os << ')';
}
@@ -2068,7 +2068,7 @@ void OperationPrinter::printSuccessorAndUseList(Operation *term,
[this](Value operand) { printValueID(operand); });
os << " : ";
interleaveComma(succOperands,
- [this](Value operand) { printType(operand->getType()); });
+ [this](Value operand) { printType(operand.getType()); });
os << ')';
}
diff --git a/mlir/lib/IR/Block.cpp b/mlir/lib/IR/Block.cpp
index 2757c505555..c1eb211610d 100644
--- a/mlir/lib/IR/Block.cpp
+++ b/mlir/lib/IR/Block.cpp
@@ -91,7 +91,7 @@ void Block::dropAllReferences() {
void Block::dropAllDefinedValueUses() {
for (auto arg : getArguments())
- arg->dropAllUses();
+ arg.dropAllUses();
for (auto &op : *this)
op.dropAllDefinedValueUses();
dropAllUses();
diff --git a/mlir/lib/IR/Builders.cpp b/mlir/lib/IR/Builders.cpp
index 5567f873b5e..0c72abf9a5e 100644
--- a/mlir/lib/IR/Builders.cpp
+++ b/mlir/lib/IR/Builders.cpp
@@ -377,7 +377,7 @@ LogicalResult OpBuilder::tryFold(Operation *op,
// Ask the dialect to materialize a constant operation for this value.
Attribute attr = it.value().get<Attribute>();
auto *constOp = dialect->materializeConstant(
- cstBuilder, attr, op->getResult(it.index())->getType(), op->getLoc());
+ cstBuilder, attr, op->getResult(it.index()).getType(), op->getLoc());
if (!constOp) {
// Erase any generated constants.
for (Operation *cst : generatedConstants)
diff --git a/mlir/lib/IR/Function.cpp b/mlir/lib/IR/Function.cpp
index 72b5ac46a8f..8b57a37bf5e 100644
--- a/mlir/lib/IR/Function.cpp
+++ b/mlir/lib/IR/Function.cpp
@@ -96,9 +96,9 @@ LogicalResult FuncOp::verify() {
auto fnInputTypes = getType().getInputs();
Block &entryBlock = front();
for (unsigned i = 0, e = entryBlock.getNumArguments(); i != e; ++i)
- if (fnInputTypes[i] != entryBlock.getArgument(i)->getType())
+ if (fnInputTypes[i] != entryBlock.getArgument(i).getType())
return emitOpError("type of entry block argument #")
- << i << '(' << entryBlock.getArgument(i)->getType()
+ << i << '(' << entryBlock.getArgument(i).getType()
<< ") must match the type of the corresponding argument in "
<< "function signature(" << fnInputTypes[i] << ')';
diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp
index 6cf7eea6b4f..1d9147c4610 100644
--- a/mlir/lib/IR/Operation.cpp
+++ b/mlir/lib/IR/Operation.cpp
@@ -809,7 +809,7 @@ LogicalResult OpTrait::impl::verifySameTypeOperands(Operation *op) {
if (nOperands < 2)
return success();
- auto type = op->getOperand(0)->getType();
+ auto type = op->getOperand(0).getType();
for (auto opType : llvm::drop_begin(op->getOperandTypes(), 1))
if (opType != type)
return op->emitOpError() << "requires all operands to have the same type";
@@ -847,7 +847,7 @@ LogicalResult OpTrait::impl::verifySameOperandsShape(Operation *op) {
if (failed(verifyAtLeastNOperands(op, 1)))
return failure();
- auto type = op->getOperand(0)->getType();
+ auto type = op->getOperand(0).getType();
for (auto opType : llvm::drop_begin(op->getOperandTypes(), 1)) {
if (failed(verifyCompatibleShape(opType, type)))
return op->emitOpError() << "requires the same shape for all operands";
@@ -860,7 +860,7 @@ LogicalResult OpTrait::impl::verifySameOperandsAndResultShape(Operation *op) {
failed(verifyAtLeastNResults(op, 1)))
return failure();
- auto type = op->getOperand(0)->getType();
+ auto type = op->getOperand(0).getType();
for (auto resultType : op->getResultTypes()) {
if (failed(verifyCompatibleShape(resultType, type)))
return op->emitOpError()
@@ -917,7 +917,7 @@ LogicalResult OpTrait::impl::verifySameOperandsAndResultType(Operation *op) {
failed(verifyAtLeastNResults(op, 1)))
return failure();
- auto type = op->getResult(0)->getType();
+ auto type = op->getResult(0).getType();
auto elementType = getElementTypeOrSelf(type);
for (auto resultType : llvm::drop_begin(op->getResultTypes(), 1)) {
if (getElementTypeOrSelf(resultType) != elementType ||
@@ -946,7 +946,7 @@ static LogicalResult verifySuccessor(Operation *op, unsigned succNo) {
auto operandIt = operands.begin();
for (unsigned i = 0, e = operandCount; i != e; ++i, ++operandIt) {
- if ((*operandIt)->getType() != destBB->getArgument(i)->getType())
+ if ((*operandIt).getType() != destBB->getArgument(i).getType())
return op->emitError() << "type mismatch for bb argument #" << i
<< " of successor #" << succNo;
}
@@ -1056,9 +1056,9 @@ LogicalResult OpTrait::impl::verifyResultSizeAttr(Operation *op,
void impl::buildBinaryOp(Builder *builder, OperationState &result, Value lhs,
Value rhs) {
- assert(lhs->getType() == rhs->getType());
+ assert(lhs.getType() == rhs.getType());
result.addOperands({lhs, rhs});
- result.types.push_back(lhs->getType());
+ result.types.push_back(lhs.getType());
}
ParseResult impl::parseOneResultSameOperandTypeOp(OpAsmParser &parser,
@@ -1077,7 +1077,7 @@ void impl::printOneResultOp(Operation *op, OpAsmPrinter &p) {
// If not all the operand and result types are the same, just use the
// generic assembly form to avoid omitting information in printing.
- auto resultType = op->getResult(0)->getType();
+ auto resultType = op->getResult(0).getType();
if (llvm::any_of(op->getOperandTypes(),
[&](Type type) { return type != resultType; })) {
p.printGenericOp(op);
@@ -1113,15 +1113,15 @@ ParseResult impl::parseCastOp(OpAsmParser &parser, OperationState &result) {
}
void impl::printCastOp(Operation *op, OpAsmPrinter &p) {
- p << op->getName() << ' ' << *op->getOperand(0);
+ p << op->getName() << ' ' << op->getOperand(0);
p.printOptionalAttrDict(op->getAttrs());
- p << " : " << op->getOperand(0)->getType() << " to "
- << op->getResult(0)->getType();
+ p << " : " << op->getOperand(0).getType() << " to "
+ << op->getResult(0).getType();
}
Value impl::foldCastOp(Operation *op) {
// Identity cast
- if (op->getOperand(0)->getType() == op->getResult(0)->getType())
+ if (op->getOperand(0).getType() == op->getResult(0).getType())
return op->getOperand(0);
return nullptr;
}
diff --git a/mlir/lib/IR/PatternMatch.cpp b/mlir/lib/IR/PatternMatch.cpp
index 50e6eeec982..69b82ffb035 100644
--- a/mlir/lib/IR/PatternMatch.cpp
+++ b/mlir/lib/IR/PatternMatch.cpp
@@ -114,7 +114,7 @@ void PatternRewriter::mergeBlocks(Block *source, Block *dest,
// Replace all of the successor arguments with the provided values.
for (auto it : llvm::zip(source->getArguments(), argValues))
- std::get<0>(it)->replaceAllUsesWith(std::get<1>(it));
+ std::get<0>(it).replaceAllUsesWith(std::get<1>(it));
// Splice the operations of the 'source' block into the 'dest' block and erase
// it.
diff --git a/mlir/lib/IR/Region.cpp b/mlir/lib/IR/Region.cpp
index 1e8abc884dd..d8d130ba369 100644
--- a/mlir/lib/IR/Region.cpp
+++ b/mlir/lib/IR/Region.cpp
@@ -84,7 +84,7 @@ void Region::cloneInto(Region *dest, Region::iterator destPos,
// argument to the cloned block.
for (auto arg : block.getArguments())
if (!mapper.contains(arg))
- mapper.map(arg, newBlock->addArgument(arg->getType()));
+ mapper.map(arg, newBlock->addArgument(arg.getType()));
// Clone and remap the operations within this block.
for (auto &op : block)
@@ -146,7 +146,7 @@ static bool isIsolatedAbove(Region &region, Region &limit,
// Check that any value that is used by an operation is defined in the
// same region as either an operation result or a block argument.
- if (operand->getParentRegion()->isProperAncestor(&limit)) {
+ if (operand.getParentRegion()->isProperAncestor(&limit)) {
if (noteLoc) {
op.emitOpError("using value defined outside the region")
.attachNote(noteLoc)
diff --git a/mlir/lib/IR/TypeUtilities.cpp b/mlir/lib/IR/TypeUtilities.cpp
index c4450f97759..3fac8158b82 100644
--- a/mlir/lib/IR/TypeUtilities.cpp
+++ b/mlir/lib/IR/TypeUtilities.cpp
@@ -25,7 +25,7 @@ Type mlir::getElementTypeOrSelf(Type type) {
}
Type mlir::getElementTypeOrSelf(Value val) {
- return getElementTypeOrSelf(val->getType());
+ return getElementTypeOrSelf(val.getType());
}
Type mlir::getElementTypeOrSelf(Attribute attr) {
@@ -92,7 +92,7 @@ OperandElementTypeIterator::OperandElementTypeIterator(
it, &unwrap) {}
Type OperandElementTypeIterator::unwrap(Value value) {
- return value->getType().cast<ShapedType>().getElementType();
+ return value.getType().cast<ShapedType>().getElementType();
}
ResultElementTypeIterator::ResultElementTypeIterator(
@@ -101,5 +101,5 @@ ResultElementTypeIterator::ResultElementTypeIterator(
it, &unwrap) {}
Type ResultElementTypeIterator::unwrap(Value value) {
- return value->getType().cast<ShapedType>().getElementType();
+ return value.getType().cast<ShapedType>().getElementType();
}
diff --git a/mlir/lib/IR/Value.cpp b/mlir/lib/IR/Value.cpp
index 13bd0bcd8f3..c8ea11cfc84 100644
--- a/mlir/lib/IR/Value.cpp
+++ b/mlir/lib/IR/Value.cpp
@@ -70,11 +70,11 @@ void Value::setType(Type newType) {
/// defines it.
Operation *Value::getDefiningOp() const {
if (auto result = dyn_cast<OpResult>())
- return result->getOwner();
+ return result.getOwner();
return nullptr;
}
-Location Value::getLoc() {
+Location Value::getLoc() const {
if (auto *op = getDefiningOp())
return op->getLoc();
return UnknownLoc::get(getContext());
@@ -84,7 +84,7 @@ Location Value::getLoc() {
Region *Value::getParentRegion() {
if (auto *op = getDefiningOp())
return op->getParentRegion();
- return cast<BlockArgument>()->getOwner()->getParent();
+ return cast<BlockArgument>().getOwner()->getParent();
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud