summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Dialect/VectorOps
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/Dialect/VectorOps
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/Dialect/VectorOps')
-rw-r--r--mlir/lib/Dialect/VectorOps/VectorOps.cpp109
-rw-r--r--mlir/lib/Dialect/VectorOps/VectorTransforms.cpp30
2 files changed, 69 insertions, 70 deletions
diff --git a/mlir/lib/Dialect/VectorOps/VectorOps.cpp b/mlir/lib/Dialect/VectorOps/VectorOps.cpp
index 92a230eb5d1..8206d10962b 100644
--- a/mlir/lib/Dialect/VectorOps/VectorOps.cpp
+++ b/mlir/lib/Dialect/VectorOps/VectorOps.cpp
@@ -67,7 +67,7 @@ void vector::ContractionOp::build(Builder *builder, OperationState &result,
ArrayAttr indexingMaps,
ArrayAttr iteratorTypes) {
result.addOperands({lhs, rhs, acc});
- result.addTypes(acc->getType());
+ result.addTypes(acc.getType());
result.addAttribute(getIndexingMapsAttrName(), indexingMaps);
result.addAttribute(getIteratorTypesAttrName(), iteratorTypes);
}
@@ -125,13 +125,13 @@ static void print(OpAsmPrinter &p, ContractionOp op) {
attrs.push_back(attr);
auto dictAttr = DictionaryAttr::get(attrs, op.getContext());
- p << op.getOperationName() << " " << dictAttr << " " << *op.lhs() << ", ";
- p << *op.rhs() << ", " << *op.acc();
+ p << op.getOperationName() << " " << dictAttr << " " << op.lhs() << ", ";
+ p << op.rhs() << ", " << op.acc();
if (op.masks().size() == 2)
p << ", " << op.masks();
p.printOptionalAttrDict(op.getAttrs(), attrNames);
- p << " : " << op.lhs()->getType() << ", " << op.rhs()->getType() << " into "
+ p << " : " << op.lhs().getType() << ", " << op.rhs().getType() << " into "
<< op.getResultType();
}
@@ -211,7 +211,7 @@ static LogicalResult verify(ContractionOp op) {
if (map.getNumDims() != numIterators)
return op.emitOpError("expected indexing map ")
<< index << " to have " << numIterators << " number of inputs";
- auto operandType = op.getOperand(index)->getType().cast<VectorType>();
+ auto operandType = op.getOperand(index).getType().cast<VectorType>();
unsigned rank = operandType.getShape().size();
if (map.getNumResults() != rank)
return op.emitOpError("expected indexing map ")
@@ -351,10 +351,10 @@ SmallVector<AffineMap, 4> ContractionOp::getIndexingMaps() {
//===----------------------------------------------------------------------===//
static void print(OpAsmPrinter &p, vector::ExtractElementOp op) {
- p << op.getOperationName() << " " << *op.vector() << "[" << *op.position()
- << " : " << op.position()->getType() << "]";
+ p << op.getOperationName() << " " << op.vector() << "[" << op.position()
+ << " : " << op.position().getType() << "]";
p.printOptionalAttrDict(op.getAttrs());
- p << " : " << op.vector()->getType();
+ p << " : " << op.vector().getType();
}
static ParseResult parseExtractElementOp(OpAsmParser &parser,
@@ -398,15 +398,15 @@ void vector::ExtractOp::build(Builder *builder, OperationState &result,
Value source, ArrayRef<int64_t> position) {
result.addOperands(source);
auto positionAttr = getVectorSubscriptAttr(*builder, position);
- result.addTypes(inferExtractOpResultType(source->getType().cast<VectorType>(),
+ result.addTypes(inferExtractOpResultType(source.getType().cast<VectorType>(),
positionAttr));
result.addAttribute(getPositionAttrName(), positionAttr);
}
static void print(OpAsmPrinter &p, vector::ExtractOp op) {
- p << op.getOperationName() << " " << *op.vector() << op.position();
+ p << op.getOperationName() << " " << op.vector() << op.position();
p.printOptionalAttrDict(op.getAttrs(), {"position"});
- p << " : " << op.vector()->getType();
+ p << " : " << op.vector().getType();
}
static ParseResult parseExtractOp(OpAsmParser &parser, OperationState &result) {
@@ -495,13 +495,13 @@ static ParseResult parseExtractSlicesOp(OpAsmParser &parser,
}
static void print(OpAsmPrinter &p, ExtractSlicesOp op) {
- p << op.getOperationName() << ' ' << *op.vector() << ", ";
+ p << op.getOperationName() << ' ' << op.vector() << ", ";
p << op.sizes() << ", " << op.strides();
p.printOptionalAttrDict(
op.getAttrs(),
/*elidedAttrs=*/{ExtractSlicesOp::getSizesAttrName(),
ExtractSlicesOp::getStridesAttrName()});
- p << " : " << op.vector()->getType();
+ p << " : " << op.vector().getType();
p << " into " << op.getResultTupleType();
}
@@ -594,7 +594,7 @@ void ExtractSlicesOp::getStrides(SmallVectorImpl<int64_t> &results) {
//===----------------------------------------------------------------------===//
static void print(OpAsmPrinter &p, BroadcastOp op) {
- p << op.getOperationName() << " " << *op.source() << " : "
+ p << op.getOperationName() << " " << op.source() << " : "
<< op.getSourceType() << " to " << op.getVectorType();
}
@@ -642,15 +642,15 @@ void ShuffleOp::build(Builder *builder, OperationState &result, Value v1,
Value v2, ArrayRef<int64_t> mask) {
result.addOperands({v1, v2});
auto maskAttr = getVectorSubscriptAttr(*builder, mask);
- result.addTypes(v1->getType());
+ result.addTypes(v1.getType());
result.addAttribute(getMaskAttrName(), maskAttr);
}
static void print(OpAsmPrinter &p, ShuffleOp op) {
- p << op.getOperationName() << " " << *op.v1() << ", " << *op.v2() << " "
+ p << op.getOperationName() << " " << op.v1() << ", " << op.v2() << " "
<< op.mask();
p.printOptionalAttrDict(op.getAttrs(), {ShuffleOp::getMaskAttrName()});
- p << " : " << op.v1()->getType() << ", " << op.v2()->getType();
+ p << " : " << op.v1().getType() << ", " << op.v2().getType();
}
static LogicalResult verify(ShuffleOp op) {
@@ -725,10 +725,10 @@ static ParseResult parseShuffleOp(OpAsmParser &parser, OperationState &result) {
//===----------------------------------------------------------------------===//
static void print(OpAsmPrinter &p, InsertElementOp op) {
- p << op.getOperationName() << " " << *op.source() << ", " << *op.dest() << "["
- << *op.position() << " : " << op.position()->getType() << "]";
+ p << op.getOperationName() << " " << op.source() << ", " << op.dest() << "["
+ << op.position() << " : " << op.position().getType() << "]";
p.printOptionalAttrDict(op.getAttrs());
- p << " : " << op.dest()->getType();
+ p << " : " << op.dest().getType();
}
static ParseResult parseInsertElementOp(OpAsmParser &parser,
@@ -766,12 +766,12 @@ void InsertOp::build(Builder *builder, OperationState &result, Value source,
Value dest, ArrayRef<int64_t> position) {
result.addOperands({source, dest});
auto positionAttr = getVectorSubscriptAttr(*builder, position);
- result.addTypes(dest->getType());
+ result.addTypes(dest.getType());
result.addAttribute(getPositionAttrName(), positionAttr);
}
static void print(OpAsmPrinter &p, InsertOp op) {
- p << op.getOperationName() << " " << *op.source() << ", " << *op.dest()
+ p << op.getOperationName() << " " << op.source() << ", " << op.dest()
<< op.position();
p.printOptionalAttrDict(op.getAttrs(), {InsertOp::getPositionAttrName()});
p << " : " << op.getSourceType() << " into " << op.getDestVectorType();
@@ -851,13 +851,13 @@ static ParseResult parseInsertSlicesOp(OpAsmParser &parser,
}
static void print(OpAsmPrinter &p, InsertSlicesOp op) {
- p << op.getOperationName() << ' ' << *op.vectors() << ", ";
+ p << op.getOperationName() << ' ' << op.vectors() << ", ";
p << op.sizes() << ", " << op.strides();
p.printOptionalAttrDict(
op.getAttrs(),
/*elidedAttrs=*/{InsertSlicesOp::getSizesAttrName(),
InsertSlicesOp::getStridesAttrName()});
- p << " : " << op.vectors()->getType();
+ p << " : " << op.vectors().getType();
p << " into " << op.getResultVectorType();
}
@@ -890,14 +890,13 @@ void InsertStridedSliceOp::build(Builder *builder, OperationState &result,
result.addOperands({source, dest});
auto offsetsAttr = getVectorSubscriptAttr(*builder, offsets);
auto stridesAttr = getVectorSubscriptAttr(*builder, strides);
- result.addTypes(dest->getType());
+ result.addTypes(dest.getType());
result.addAttribute(getOffsetsAttrName(), offsetsAttr);
result.addAttribute(getStridesAttrName(), stridesAttr);
}
static void print(OpAsmPrinter &p, InsertStridedSliceOp op) {
- p << op.getOperationName() << " " << *op.source() << ", " << *op.dest()
- << " ";
+ p << op.getOperationName() << " " << op.source() << ", " << op.dest() << " ";
p.printOptionalAttrDict(op.getAttrs());
p << " : " << op.getSourceVectorType() << " into " << op.getDestVectorType();
}
@@ -1049,10 +1048,10 @@ static LogicalResult verify(InsertStridedSliceOp op) {
//===----------------------------------------------------------------------===//
static void print(OpAsmPrinter &p, OuterProductOp op) {
- p << op.getOperationName() << " " << *op.lhs() << ", " << *op.rhs();
+ p << op.getOperationName() << " " << op.lhs() << ", " << op.rhs();
if (!op.acc().empty())
p << ", " << op.acc();
- p << " : " << op.lhs()->getType() << ", " << op.rhs()->getType();
+ p << " : " << op.lhs().getType() << ", " << op.rhs().getType();
}
static ParseResult parseOuterProductOp(OpAsmParser &parser,
@@ -1103,7 +1102,7 @@ static LogicalResult verify(OuterProductOp op) {
//===----------------------------------------------------------------------===//
static void print(OpAsmPrinter &p, ReshapeOp op) {
- p << op.getOperationName() << " " << *op.vector() << ", [" << op.input_shape()
+ p << op.getOperationName() << " " << op.vector() << ", [" << op.input_shape()
<< "], [" << op.output_shape() << "], " << op.fixed_vector_sizes();
SmallVector<StringRef, 2> elidedAttrs = {
ReshapeOp::getOperandSegmentSizeAttr(),
@@ -1193,18 +1192,18 @@ static LogicalResult verify(ReshapeOp op) {
// If all shape operands are produced by constant ops, verify that product
// of dimensions for input/output shape match.
auto isDefByConstant = [](Value operand) {
- return isa_and_nonnull<ConstantIndexOp>(operand->getDefiningOp());
+ return isa_and_nonnull<ConstantIndexOp>(operand.getDefiningOp());
};
if (llvm::all_of(op.input_shape(), isDefByConstant) &&
llvm::all_of(op.output_shape(), isDefByConstant)) {
int64_t numInputElements = 1;
for (auto operand : op.input_shape())
numInputElements *=
- cast<ConstantIndexOp>(operand->getDefiningOp()).getValue();
+ cast<ConstantIndexOp>(operand.getDefiningOp()).getValue();
int64_t numOutputElements = 1;
for (auto operand : op.output_shape())
numOutputElements *=
- cast<ConstantIndexOp>(operand->getDefiningOp()).getValue();
+ cast<ConstantIndexOp>(operand.getDefiningOp()).getValue();
if (numInputElements != numOutputElements)
return op.emitError("product of input and output shape sizes must match");
}
@@ -1245,7 +1244,7 @@ void StridedSliceOp::build(Builder *builder, OperationState &result,
auto sizesAttr = getVectorSubscriptAttr(*builder, sizes);
auto stridesAttr = getVectorSubscriptAttr(*builder, strides);
result.addTypes(
- inferStridedSliceOpResultType(source->getType().cast<VectorType>(),
+ inferStridedSliceOpResultType(source.getType().cast<VectorType>(),
offsetsAttr, sizesAttr, stridesAttr));
result.addAttribute(getOffsetsAttrName(), offsetsAttr);
result.addAttribute(getSizesAttrName(), sizesAttr);
@@ -1253,9 +1252,9 @@ void StridedSliceOp::build(Builder *builder, OperationState &result,
}
static void print(OpAsmPrinter &p, StridedSliceOp op) {
- p << op.getOperationName() << " " << *op.vector();
+ p << op.getOperationName() << " " << op.vector();
p.printOptionalAttrDict(op.getAttrs());
- p << " : " << op.vector()->getType() << " to " << op.getResult()->getType();
+ p << " : " << op.vector().getType() << " to " << op.getResult().getType();
}
static ParseResult parseStridedSliceOp(OpAsmParser &parser,
@@ -1305,7 +1304,7 @@ static LogicalResult verify(StridedSliceOp op) {
auto resultType = inferStridedSliceOpResultType(
op.getVectorType(), op.offsets(), op.sizes(), op.strides());
- if (op.getResult()->getType() != resultType) {
+ if (op.getResult().getType() != resultType) {
op.emitOpError("expected result type to be ") << resultType;
return failure();
}
@@ -1328,7 +1327,7 @@ public:
PatternMatchResult matchAndRewrite(StridedSliceOp stridedSliceOp,
PatternRewriter &rewriter) const override {
// Return if 'stridedSliceOp' operand is not defined by a ConstantMaskOp.
- auto defOp = stridedSliceOp.vector()->getDefiningOp();
+ auto defOp = stridedSliceOp.vector().getDefiningOp();
auto constantMaskOp = dyn_cast_or_null<ConstantMaskOp>(defOp);
if (!constantMaskOp)
return matchFailure();
@@ -1365,7 +1364,7 @@ public:
// Replace 'stridedSliceOp' with ConstantMaskOp with sliced mask region.
rewriter.replaceOpWithNewOp<ConstantMaskOp>(
- stridedSliceOp, stridedSliceOp.getResult()->getType(),
+ stridedSliceOp, stridedSliceOp.getResult().getType(),
vector::getVectorSubscriptAttr(rewriter, sliceMaskDimSizes));
return matchSuccess();
}
@@ -1503,7 +1502,7 @@ static LogicalResult verify(TransferReadOp op) {
// Consistency of elemental types in memref and vector.
MemRefType memrefType = op.getMemRefType();
VectorType vectorType = op.getVectorType();
- auto paddingType = op.padding()->getType();
+ auto paddingType = op.padding().getType();
auto permutationMap = op.permutation_map();
auto memrefElementType = memrefType.getElementType();
@@ -1540,8 +1539,8 @@ static LogicalResult verify(TransferReadOp op) {
// TransferWriteOp
//===----------------------------------------------------------------------===//
static void print(OpAsmPrinter &p, TransferWriteOp op) {
- p << op.getOperationName() << " " << *op.vector() << ", " << *op.memref()
- << "[" << op.indices() << "]";
+ p << op.getOperationName() << " " << op.vector() << ", " << op.memref() << "["
+ << op.indices() << "]";
p.printOptionalAttrDict(op.getAttrs());
p << " : " << op.getVectorType() << ", " << op.getMemRefType();
}
@@ -1596,12 +1595,12 @@ static MemRefType inferVectorTypeCastResultType(MemRefType t) {
void TypeCastOp::build(Builder *builder, OperationState &result, Value source) {
result.addOperands(source);
result.addTypes(
- inferVectorTypeCastResultType(source->getType().cast<MemRefType>()));
+ inferVectorTypeCastResultType(source.getType().cast<MemRefType>()));
}
static void print(OpAsmPrinter &p, TypeCastOp op) {
- auto type = op.getOperand()->getType().cast<MemRefType>();
- p << op.getOperationName() << ' ' << *op.memref() << " : " << type << " to "
+ auto type = op.getOperand().getType().cast<MemRefType>();
+ p << op.getOperationName() << ' ' << op.memref() << " : " << type << " to "
<< inferVectorTypeCastResultType(type);
}
@@ -1665,14 +1664,14 @@ static ParseResult parseTupleGetOp(OpAsmParser &parser,
}
static void print(OpAsmPrinter &p, TupleGetOp op) {
- p << op.getOperationName() << ' ' << *op.getOperand() << ", " << op.index();
+ p << op.getOperationName() << ' ' << op.getOperand() << ", " << op.index();
p.printOptionalAttrDict(op.getAttrs(),
/*elidedAttrs=*/{TupleGetOp::getIndexAttrName()});
- p << " : " << op.getOperand()->getType();
+ p << " : " << op.getOperand().getType();
}
static LogicalResult verify(TupleGetOp op) {
- auto tupleType = op.getOperand()->getType().cast<TupleType>();
+ auto tupleType = op.getOperand().getType().cast<TupleType>();
if (op.getIndex() < 0 ||
op.getIndex() >= static_cast<int64_t>(tupleType.size()))
return op.emitOpError("tuple get index out of range");
@@ -1696,12 +1695,12 @@ ParseResult parseConstantMaskOp(OpAsmParser &parser, OperationState &result) {
static void print(OpAsmPrinter &p, ConstantMaskOp op) {
p << op.getOperationName() << ' ' << op.mask_dim_sizes() << " : "
- << op.getResult()->getType();
+ << op.getResult().getType();
}
static LogicalResult verify(ConstantMaskOp &op) {
// Verify that array attr size matches the rank of the vector result.
- auto resultType = op.getResult()->getType().cast<VectorType>();
+ auto resultType = op.getResult().getType().cast<VectorType>();
if (static_cast<int64_t>(op.mask_dim_sizes().size()) != resultType.getRank())
return op.emitOpError(
"must specify array attr of size equal vector result rank");
@@ -1749,7 +1748,7 @@ static void print(OpAsmPrinter &p, CreateMaskOp op) {
static LogicalResult verify(CreateMaskOp op) {
// Verify that an operand was specified for each result vector each dimension.
if (op.getNumOperands() !=
- op.getResult()->getType().cast<VectorType>().getRank())
+ op.getResult().getType().cast<VectorType>().getRank())
return op.emitOpError(
"must specify an operand for each result vector dimension");
return success();
@@ -1768,7 +1767,7 @@ ParseResult parsePrintOp(OpAsmParser &parser, OperationState &result) {
}
static void print(OpAsmPrinter &p, PrintOp op) {
- p << op.getOperationName() << ' ' << *op.source() << " : "
+ p << op.getOperationName() << ' ' << op.source() << " : "
<< op.getPrintType();
}
@@ -1783,19 +1782,19 @@ public:
PatternRewriter &rewriter) const override {
// Return if any of 'createMaskOp' operands are not defined by a constant.
auto is_not_def_by_constant = [](Value operand) {
- return !isa_and_nonnull<ConstantIndexOp>(operand->getDefiningOp());
+ return !isa_and_nonnull<ConstantIndexOp>(operand.getDefiningOp());
};
if (llvm::any_of(createMaskOp.operands(), is_not_def_by_constant))
return matchFailure();
// Gather constant mask dimension sizes.
SmallVector<int64_t, 4> maskDimSizes;
for (auto operand : createMaskOp.operands()) {
- auto defOp = operand->getDefiningOp();
+ auto defOp = operand.getDefiningOp();
maskDimSizes.push_back(cast<ConstantIndexOp>(defOp).getValue());
}
// Replace 'createMaskOp' with ConstantMaskOp.
rewriter.replaceOpWithNewOp<ConstantMaskOp>(
- createMaskOp, createMaskOp.getResult()->getType(),
+ createMaskOp, createMaskOp.getResult().getType(),
vector::getVectorSubscriptAttr(rewriter, maskDimSizes));
return matchSuccess();
}
diff --git a/mlir/lib/Dialect/VectorOps/VectorTransforms.cpp b/mlir/lib/Dialect/VectorOps/VectorTransforms.cpp
index 9fcbd0cb921..d98f41e3d63 100644
--- a/mlir/lib/Dialect/VectorOps/VectorTransforms.cpp
+++ b/mlir/lib/Dialect/VectorOps/VectorTransforms.cpp
@@ -195,7 +195,7 @@ static void initUnrolledVectorState(VectorType vectorType, Value initValue,
auto tupleType =
generateExtractSlicesOpResultType(vectorType, sizes, strides, builder);
state.slicesTuple = builder.create<vector::ExtractSlicesOp>(
- initValue->getLoc(), tupleType, initValue, sizes, strides);
+ initValue.getLoc(), tupleType, initValue, sizes, strides);
}
}
@@ -232,7 +232,7 @@ static Value getOrCreateUnrolledVectorSlice(
if (valueSlice == nullptr) {
// Return tuple element at 'sliceLinearIndex'.
auto tupleIndex = builder.getI64IntegerAttr(sliceLinearIndex);
- auto initValueType = initValue->getType().cast<VectorType>();
+ auto initValueType = initValue.getType().cast<VectorType>();
auto vectorType =
VectorType::get(state.unrolledShape, initValueType.getElementType());
// Initialize 'cache' with slice from 'initValue'.
@@ -311,7 +311,7 @@ static Value unrollSingleResultStructuredOp(Operation *op,
unsigned resultIndex,
ArrayRef<int64_t> targetShape,
PatternRewriter &builder) {
- auto shapedType = op->getResult(0)->getType().dyn_cast_or_null<ShapedType>();
+ auto shapedType = op->getResult(0).getType().dyn_cast_or_null<ShapedType>();
if (!shapedType || !shapedType.hasStaticShape())
assert(false && "Expected a statically shaped result type");
@@ -379,7 +379,7 @@ static Value unrollSingleResultStructuredOp(Operation *op,
SmallVector<Type, 4> vectorTupleTypes(resultValueState.numInstances);
SmallVector<Value, 4> vectorTupleValues(resultValueState.numInstances);
for (unsigned i = 0; i < resultValueState.numInstances; ++i) {
- vectorTupleTypes[i] = caches[resultIndex][i]->getType().cast<VectorType>();
+ vectorTupleTypes[i] = caches[resultIndex][i].getType().cast<VectorType>();
vectorTupleValues[i] = caches[resultIndex][i];
}
TupleType tupleType = builder.getTupleType(vectorTupleTypes);
@@ -387,7 +387,7 @@ static Value unrollSingleResultStructuredOp(Operation *op,
vectorTupleValues);
// Create InsertSlicesOp(Tuple(result_vectors)).
- auto resultVectorType = op->getResult(0)->getType().cast<VectorType>();
+ auto resultVectorType = op->getResult(0).getType().cast<VectorType>();
SmallVector<int64_t, 4> sizes(resultValueState.unrolledShape);
SmallVector<int64_t, 4> strides(resultValueState.unrollFactors.size(), 1);
@@ -411,7 +411,7 @@ static void getVectorContractionOpUnrollState(
vectors.resize(numIterators);
unsigned accOperandIndex = vector::ContractionOp::getAccOperandIndex();
for (unsigned i = 0; i < numIterators; ++i) {
- vectors[i].type = contractionOp.getOperand(i)->getType().cast<VectorType>();
+ vectors[i].type = contractionOp.getOperand(i).getType().cast<VectorType>();
vectors[i].indexMap = iterationIndexMapList[i];
vectors[i].operandIndex = i;
vectors[i].isAcc = i == accOperandIndex ? true : false;
@@ -437,7 +437,7 @@ getVectorElementwiseOpUnrollState(Operation *op, ArrayRef<int64_t> targetShape,
std::vector<VectorState> &vectors,
unsigned &resultIndex) {
// Verify that operation and operands all have the same vector shape.
- auto resultType = op->getResult(0)->getType().dyn_cast_or_null<VectorType>();
+ auto resultType = op->getResult(0).getType().dyn_cast_or_null<VectorType>();
assert(resultType && "Expected op with vector result type");
auto resultShape = resultType.getShape();
// Verify that all operands have the same vector type as result.
@@ -515,7 +515,7 @@ generateTransferOpSlices(VectorType vectorType, TupleType tupleType,
getAffineConstantExpr(offsets[it.index()], ctx);
auto map = AffineMap::get(/*dimCount=*/1, /*symbolCount=*/0, expr);
sliceIndices[it.index()] = rewriter.create<AffineApplyOp>(
- it.value()->getLoc(), map, ArrayRef<Value>(it.value()));
+ it.value().getLoc(), map, ArrayRef<Value>(it.value()));
}
// Call 'fn' to generate slice 'i' at 'sliceIndices'.
fn(i, sliceIndices);
@@ -536,8 +536,8 @@ struct SplitTransferReadOp : public OpRewritePattern<vector::TransferReadOp> {
// Return unless the unique 'xferReadOp' user is an ExtractSlicesOp.
Value xferReadResult = xferReadOp.getResult();
auto extractSlicesOp =
- dyn_cast<vector::ExtractSlicesOp>(*xferReadResult->getUsers().begin());
- if (!xferReadResult->hasOneUse() || !extractSlicesOp)
+ dyn_cast<vector::ExtractSlicesOp>(*xferReadResult.getUsers().begin());
+ if (!xferReadResult.hasOneUse() || !extractSlicesOp)
return matchFailure();
// Get 'sizes' and 'strides' parameters from ExtractSlicesOp user.
@@ -587,14 +587,14 @@ struct SplitTransferWriteOp : public OpRewritePattern<vector::TransferWriteOp> {
if (!xferWriteOp.permutation_map().isIdentity())
return matchFailure();
// Return unless the 'xferWriteOp' 'vector' operand is an 'InsertSlicesOp'.
- auto *vectorDefOp = xferWriteOp.vector()->getDefiningOp();
+ auto *vectorDefOp = xferWriteOp.vector().getDefiningOp();
auto insertSlicesOp = dyn_cast_or_null<vector::InsertSlicesOp>(vectorDefOp);
if (!insertSlicesOp)
return matchFailure();
// Get TupleOp operand of 'insertSlicesOp'.
auto tupleOp = dyn_cast_or_null<vector::TupleOp>(
- insertSlicesOp.vectors()->getDefiningOp());
+ insertSlicesOp.vectors().getDefiningOp());
if (!tupleOp)
return matchFailure();
@@ -634,19 +634,19 @@ struct TupleGetFolderOp : public OpRewritePattern<vector::TupleGetOp> {
PatternRewriter &rewriter) const override {
// Return if 'tupleGetOp.vectors' arg was not defined by ExtractSlicesOp.
auto extractSlicesOp = dyn_cast_or_null<vector::ExtractSlicesOp>(
- tupleGetOp.vectors()->getDefiningOp());
+ tupleGetOp.vectors().getDefiningOp());
if (!extractSlicesOp)
return matchFailure();
// Return if 'extractSlicesOp.vector' arg was not defined by InsertSlicesOp.
auto insertSlicesOp = dyn_cast_or_null<vector::InsertSlicesOp>(
- extractSlicesOp.vector()->getDefiningOp());
+ extractSlicesOp.vector().getDefiningOp());
if (!insertSlicesOp)
return matchFailure();
// Return if 'insertSlicesOp.vectors' arg was not defined by TupleOp.
auto tupleOp = dyn_cast_or_null<vector::TupleOp>(
- insertSlicesOp.vectors()->getDefiningOp());
+ insertSlicesOp.vectors().getDefiningOp());
if (!tupleOp)
return matchFailure();
OpenPOWER on IntegriCloud