diff options
Diffstat (limited to 'mlir/lib/Dialect/AffineOps/AffineOps.cpp')
-rw-r--r-- | mlir/lib/Dialect/AffineOps/AffineOps.cpp | 147 |
1 files changed, 74 insertions, 73 deletions
diff --git a/mlir/lib/Dialect/AffineOps/AffineOps.cpp b/mlir/lib/Dialect/AffineOps/AffineOps.cpp index ef4060d4302..3a21de389c7 100644 --- a/mlir/lib/Dialect/AffineOps/AffineOps.cpp +++ b/mlir/lib/Dialect/AffineOps/AffineOps.cpp @@ -115,8 +115,8 @@ static bool isFunctionRegion(Region *region) { /// A utility function to check if a value is defined at the top level of a /// function. A value of index type defined at the top level is always a valid /// symbol. -bool mlir::isTopLevelValue(Value *value) { - if (auto *arg = dyn_cast<BlockArgument>(value)) +bool mlir::isTopLevelValue(ValuePtr value) { + if (auto arg = dyn_cast<BlockArgument>(value)) return isFunctionRegion(arg->getOwner()->getParent()); return isFunctionRegion(value->getDefiningOp()->getParentRegion()); } @@ -124,7 +124,7 @@ bool mlir::isTopLevelValue(Value *value) { // Value can be used as a dimension id if it is valid as a symbol, or // it is an induction variable, or it is a result of affine apply operation // with dimension id arguments. -bool mlir::isValidDim(Value *value) { +bool mlir::isValidDim(ValuePtr value) { // The value must be an index type. if (!value->getType().isIndex()) return false; @@ -184,7 +184,7 @@ static bool isDimOpValidSymbol(DimOp dimOp) { // the top level, or it is a result of affine apply operation with symbol // arguments, or a result of the dim op on a memref satisfying certain // constraints. -bool mlir::isValidSymbol(Value *value) { +bool mlir::isValidSymbol(ValuePtr value) { // The value must be an index type. if (!value->getType().isIndex()) return false; @@ -207,7 +207,7 @@ bool mlir::isValidSymbol(Value *value) { // Returns true if 'value' is a valid index to an affine operation (e.g. // affine.load, affine.store, affine.dma_start, affine.dma_wait). // Returns false otherwise. -static bool isValidAffineIndexOperand(Value *value) { +static bool isValidAffineIndexOperand(ValuePtr value) { return isValidDim(value) || isValidSymbol(value); } @@ -221,7 +221,7 @@ static LogicalResult verifyDimAndSymbolIdentifiers(OpTy &op, Operation::operand_range operands, unsigned numDims) { unsigned opIt = 0; - for (auto *operand : operands) { + for (auto operand : operands) { if (opIt++ < numDims) { if (!isValidDim(operand)) return op.emitOpError("operand cannot be used as a dimension id"); @@ -306,14 +306,14 @@ LogicalResult AffineApplyOp::verify() { // its operands are valid dimension ids. bool AffineApplyOp::isValidDim() { return llvm::all_of(getOperands(), - [](Value *op) { return mlir::isValidDim(op); }); + [](ValuePtr op) { return mlir::isValidDim(op); }); } // The result of the affine apply operation can be used as a symbol if all its // operands are symbols. bool AffineApplyOp::isValidSymbol() { return llvm::all_of(getOperands(), - [](Value *op) { return mlir::isValidSymbol(op); }); + [](ValuePtr op) { return mlir::isValidSymbol(op); }); } OpFoldResult AffineApplyOp::fold(ArrayRef<Attribute> operands) { @@ -333,8 +333,8 @@ OpFoldResult AffineApplyOp::fold(ArrayRef<Attribute> operands) { return result[0]; } -AffineDimExpr AffineApplyNormalizer::renumberOneDim(Value *v) { - DenseMap<Value *, unsigned>::iterator iterPos; +AffineDimExpr AffineApplyNormalizer::renumberOneDim(ValuePtr v) { + DenseMap<ValuePtr, unsigned>::iterator iterPos; bool inserted = false; std::tie(iterPos, inserted) = dimValueToPosition.insert(std::make_pair(v, dimValueToPosition.size())); @@ -347,7 +347,7 @@ AffineDimExpr AffineApplyNormalizer::renumberOneDim(Value *v) { AffineMap AffineApplyNormalizer::renumber(const AffineApplyNormalizer &other) { SmallVector<AffineExpr, 8> dimRemapping; - for (auto *v : other.reorderedDims) { + for (auto v : other.reorderedDims) { auto kvp = other.dimValueToPosition.find(v); if (dimRemapping.size() <= kvp->second) dimRemapping.resize(kvp->second + 1); @@ -371,7 +371,7 @@ AffineMap AffineApplyNormalizer::renumber(const AffineApplyNormalizer &other) { // Gather the positions of the operands that are produced by an AffineApplyOp. static llvm::SetVector<unsigned> -indicesFromAffineApplyOp(ArrayRef<Value *> operands) { +indicesFromAffineApplyOp(ArrayRef<ValuePtr> operands) { llvm::SetVector<unsigned> res; for (auto en : llvm::enumerate(operands)) if (isa_and_nonnull<AffineApplyOp>(en.value()->getDefiningOp())) @@ -393,13 +393,13 @@ indicesFromAffineApplyOp(ArrayRef<Value *> operands) { // results in better simplifications and foldings. But we should evaluate // whether this behavior is what we really want after using more. static AffineMap promoteComposedSymbolsAsDims(AffineMap map, - ArrayRef<Value *> symbols) { + ArrayRef<ValuePtr> symbols) { if (symbols.empty()) { return map; } // Sanity check on symbols. - for (auto *sym : symbols) { + for (auto sym : symbols) { assert(isValidSymbol(sym) && "Expected only valid symbols"); (void)sym; } @@ -446,7 +446,7 @@ static AffineMap promoteComposedSymbolsAsDims(AffineMap map, /// `(d0)[s0, s1] -> (d0 + s0 + s1)`. /// /// The result is only equivalent to `(d0)[s0] -> (d0 + 2 * s0)` when -/// applied to the same mlir::Value* for both s0 and s1. +/// applied to the same mlir::Value for both s0 and s1. /// As a consequence mathematical composition of AffineMap always concatenates /// symbols. /// @@ -462,7 +462,7 @@ static AffineMap promoteComposedSymbolsAsDims(AffineMap map, /// benefit potentially big: simpler and more maintainable code for a /// non-trivial, recursive, procedure. AffineApplyNormalizer::AffineApplyNormalizer(AffineMap map, - ArrayRef<Value *> operands) + ArrayRef<ValuePtr> operands) : AffineApplyNormalizer() { static_assert(kMaxAffineApplyDepth > 0, "kMaxAffineApplyDepth must be > 0"); assert(map.getNumInputs() == operands.size() && @@ -495,7 +495,7 @@ AffineApplyNormalizer::AffineApplyNormalizer(AffineMap map, if (!furtherCompose) { // 1. Only dispatch dims or symbols. for (auto en : llvm::enumerate(operands)) { - auto *t = en.value(); + auto t = en.value(); assert(t->getType().isIndex()); bool isDim = (en.index() < map.getNumDims()); if (isDim) { @@ -511,14 +511,14 @@ AffineApplyNormalizer::AffineApplyNormalizer(AffineMap map, assert(numDimsBeforeRewrite <= operands.size()); // 2. Compose AffineApplyOps and dispatch dims or symbols. for (unsigned i = 0, e = operands.size(); i < e; ++i) { - auto *t = operands[i]; + auto t = operands[i]; auto affineApply = dyn_cast_or_null<AffineApplyOp>(t->getDefiningOp()); if (affineApply) { // a. Compose affine.apply operations. LLVM_DEBUG(affineApply.getOperation()->print( dbgs() << "\nCompose AffineApplyOp recursively: ")); AffineMap affineApplyMap = affineApply.getAffineMap(); - SmallVector<Value *, 8> affineApplyOperands( + SmallVector<ValuePtr, 8> affineApplyOperands( affineApply.getOperands().begin(), affineApply.getOperands().end()); AffineApplyNormalizer normalizer(affineApplyMap, affineApplyOperands); @@ -569,8 +569,8 @@ AffineApplyNormalizer::AffineApplyNormalizer(AffineMap map, LLVM_DEBUG(dbgs() << "\n"); } -void AffineApplyNormalizer::normalize(AffineMap *otherMap, - SmallVectorImpl<Value *> *otherOperands) { +void AffineApplyNormalizer::normalize( + AffineMap *otherMap, SmallVectorImpl<ValuePtr> *otherOperands) { AffineApplyNormalizer other(*otherMap, *otherOperands); *otherMap = renumber(other); @@ -584,7 +584,7 @@ void AffineApplyNormalizer::normalize(AffineMap *otherMap, /// on `map` and `operands` without creating an AffineApplyOp that needs to be /// immediately deleted. static void composeAffineMapAndOperands(AffineMap *map, - SmallVectorImpl<Value *> *operands) { + SmallVectorImpl<ValuePtr> *operands) { AffineApplyNormalizer normalizer(*map, *operands); auto normalizedMap = normalizer.getAffineMap(); auto normalizedOperands = normalizer.getOperands(); @@ -595,8 +595,8 @@ static void composeAffineMapAndOperands(AffineMap *map, } void mlir::fullyComposeAffineMapAndOperands( - AffineMap *map, SmallVectorImpl<Value *> *operands) { - while (llvm::any_of(*operands, [](Value *v) { + AffineMap *map, SmallVectorImpl<ValuePtr> *operands) { + while (llvm::any_of(*operands, [](ValuePtr v) { return isa_and_nonnull<AffineApplyOp>(v->getDefiningOp()); })) { composeAffineMapAndOperands(map, operands); @@ -605,9 +605,9 @@ void mlir::fullyComposeAffineMapAndOperands( AffineApplyOp mlir::makeComposedAffineApply(OpBuilder &b, Location loc, AffineMap map, - ArrayRef<Value *> operands) { + ArrayRef<ValuePtr> operands) { AffineMap normalizedMap = map; - SmallVector<Value *, 8> normalizedOperands(operands.begin(), operands.end()); + SmallVector<ValuePtr, 8> normalizedOperands(operands.begin(), operands.end()); composeAffineMapAndOperands(&normalizedMap, &normalizedOperands); assert(normalizedMap); return b.create<AffineApplyOp>(loc, normalizedMap, normalizedOperands); @@ -617,7 +617,7 @@ AffineApplyOp mlir::makeComposedAffineApply(OpBuilder &b, Location loc, // canonicalizes dims that are valid symbols into actual symbols. template <class MapOrSet> static void canonicalizePromotedSymbols(MapOrSet *mapOrSet, - SmallVectorImpl<Value *> *operands) { + SmallVectorImpl<ValuePtr> *operands) { if (!mapOrSet || operands->empty()) return; @@ -625,9 +625,9 @@ static void canonicalizePromotedSymbols(MapOrSet *mapOrSet, "map/set inputs must match number of operands"); auto *context = mapOrSet->getContext(); - SmallVector<Value *, 8> resultOperands; + SmallVector<ValuePtr, 8> resultOperands; resultOperands.reserve(operands->size()); - SmallVector<Value *, 8> remappedSymbols; + SmallVector<ValuePtr, 8> remappedSymbols; remappedSymbols.reserve(operands->size()); unsigned nextDim = 0; unsigned nextSym = 0; @@ -661,7 +661,7 @@ static void canonicalizePromotedSymbols(MapOrSet *mapOrSet, template <class MapOrSet> static void canonicalizeMapOrSetAndOperands(MapOrSet *mapOrSet, - SmallVectorImpl<Value *> *operands) { + SmallVectorImpl<ValuePtr> *operands) { static_assert(std::is_same<MapOrSet, AffineMap>::value || std::is_same<MapOrSet, IntegerSet>::value, "Argument must be either of AffineMap or IntegerSet type"); @@ -686,10 +686,10 @@ canonicalizeMapOrSetAndOperands(MapOrSet *mapOrSet, auto *context = mapOrSet->getContext(); - SmallVector<Value *, 8> resultOperands; + SmallVector<ValuePtr, 8> resultOperands; resultOperands.reserve(operands->size()); - llvm::SmallDenseMap<Value *, AffineExpr, 8> seenDims; + llvm::SmallDenseMap<ValuePtr, AffineExpr, 8> seenDims; SmallVector<AffineExpr, 8> dimRemapping(mapOrSet->getNumDims()); unsigned nextDim = 0; for (unsigned i = 0, e = mapOrSet->getNumDims(); i != e; ++i) { @@ -705,7 +705,7 @@ canonicalizeMapOrSetAndOperands(MapOrSet *mapOrSet, } } } - llvm::SmallDenseMap<Value *, AffineExpr, 8> seenSymbols; + llvm::SmallDenseMap<ValuePtr, AffineExpr, 8> seenSymbols; SmallVector<AffineExpr, 8> symRemapping(mapOrSet->getNumSymbols()); unsigned nextSym = 0; for (unsigned i = 0, e = mapOrSet->getNumSymbols(); i != e; ++i) { @@ -738,12 +738,12 @@ canonicalizeMapOrSetAndOperands(MapOrSet *mapOrSet, } void mlir::canonicalizeMapAndOperands(AffineMap *map, - SmallVectorImpl<Value *> *operands) { + SmallVectorImpl<ValuePtr> *operands) { canonicalizeMapOrSetAndOperands<AffineMap>(map, operands); } void mlir::canonicalizeSetAndOperands(IntegerSet *set, - SmallVectorImpl<Value *> *operands) { + SmallVectorImpl<ValuePtr> *operands) { canonicalizeMapOrSetAndOperands<IntegerSet>(set, operands); } @@ -758,7 +758,7 @@ struct SimplifyAffineOp : public OpRewritePattern<AffineOpTy> { /// Replace the affine op with another instance of it with the supplied /// map and mapOperands. void replaceAffineOp(PatternRewriter &rewriter, AffineOpTy affineOp, - AffineMap map, ArrayRef<Value *> mapOperands) const; + AffineMap map, ArrayRef<ValuePtr> mapOperands) const; PatternMatchResult matchAndRewrite(AffineOpTy affineOp, PatternRewriter &rewriter) const override { @@ -770,7 +770,7 @@ struct SimplifyAffineOp : public OpRewritePattern<AffineOpTy> { auto map = affineOp.getAffineMap(); AffineMap oldMap = map; auto oldOperands = affineOp.getMapOperands(); - SmallVector<Value *, 8> resultOperands(oldOperands); + SmallVector<ValuePtr, 8> resultOperands(oldOperands); composeAffineMapAndOperands(&map, &resultOperands); if (map == oldMap && std::equal(oldOperands.begin(), oldOperands.end(), resultOperands.begin())) @@ -786,14 +786,14 @@ struct SimplifyAffineOp : public OpRewritePattern<AffineOpTy> { template <> void SimplifyAffineOp<AffineLoadOp>::replaceAffineOp( PatternRewriter &rewriter, AffineLoadOp load, AffineMap map, - ArrayRef<Value *> mapOperands) const { + ArrayRef<ValuePtr> mapOperands) const { rewriter.replaceOpWithNewOp<AffineLoadOp>(load, load.getMemRef(), map, mapOperands); } template <> void SimplifyAffineOp<AffinePrefetchOp>::replaceAffineOp( PatternRewriter &rewriter, AffinePrefetchOp prefetch, AffineMap map, - ArrayRef<Value *> mapOperands) const { + ArrayRef<ValuePtr> mapOperands) const { rewriter.replaceOpWithNewOp<AffinePrefetchOp>( prefetch, prefetch.memref(), map, mapOperands, prefetch.localityHint().getZExtValue(), prefetch.isWrite(), @@ -802,14 +802,14 @@ void SimplifyAffineOp<AffinePrefetchOp>::replaceAffineOp( template <> void SimplifyAffineOp<AffineStoreOp>::replaceAffineOp( PatternRewriter &rewriter, AffineStoreOp store, AffineMap map, - ArrayRef<Value *> mapOperands) const { + ArrayRef<ValuePtr> mapOperands) const { rewriter.replaceOpWithNewOp<AffineStoreOp>( store, store.getValueToStore(), store.getMemRef(), map, mapOperands); } template <> void SimplifyAffineOp<AffineApplyOp>::replaceAffineOp( PatternRewriter &rewriter, AffineApplyOp apply, AffineMap map, - ArrayRef<Value *> mapOperands) const { + ArrayRef<ValuePtr> mapOperands) const { rewriter.replaceOpWithNewOp<AffineApplyOp>(apply, map, mapOperands); } } // end anonymous namespace. @@ -844,12 +844,12 @@ static LogicalResult foldMemRefCast(Operation *op) { // TODO(b/133776335) Check that map operands are loop IVs or symbols. void AffineDmaStartOp::build(Builder *builder, OperationState &result, - Value *srcMemRef, AffineMap srcMap, - ValueRange srcIndices, Value *destMemRef, + ValuePtr srcMemRef, AffineMap srcMap, + ValueRange srcIndices, ValuePtr destMemRef, AffineMap dstMap, ValueRange destIndices, - Value *tagMemRef, AffineMap tagMap, - ValueRange tagIndices, Value *numElements, - Value *stride, Value *elementsPerStride) { + ValuePtr tagMemRef, AffineMap tagMap, + ValueRange tagIndices, ValuePtr numElements, + ValuePtr stride, ValuePtr elementsPerStride) { result.addOperands(srcMemRef); result.addAttribute(getSrcMapAttrName(), AffineMapAttr::get(srcMap)); result.addOperands(srcIndices); @@ -980,19 +980,19 @@ LogicalResult AffineDmaStartOp::verify() { return emitOpError("incorrect number of operands"); } - for (auto *idx : getSrcIndices()) { + for (auto idx : getSrcIndices()) { if (!idx->getType().isIndex()) return emitOpError("src index to dma_start must have 'index' type"); if (!isValidAffineIndexOperand(idx)) return emitOpError("src index must be a dimension or symbol identifier"); } - for (auto *idx : getDstIndices()) { + for (auto idx : getDstIndices()) { if (!idx->getType().isIndex()) return emitOpError("dst index to dma_start must have 'index' type"); if (!isValidAffineIndexOperand(idx)) return emitOpError("dst index must be a dimension or symbol identifier"); } - for (auto *idx : getTagIndices()) { + for (auto idx : getTagIndices()) { if (!idx->getType().isIndex()) return emitOpError("tag index to dma_start must have 'index' type"); if (!isValidAffineIndexOperand(idx)) @@ -1013,8 +1013,8 @@ LogicalResult AffineDmaStartOp::fold(ArrayRef<Attribute> cstOperands, // TODO(b/133776335) Check that map operands are loop IVs or symbols. void AffineDmaWaitOp::build(Builder *builder, OperationState &result, - Value *tagMemRef, AffineMap tagMap, - ValueRange tagIndices, Value *numElements) { + ValuePtr tagMemRef, AffineMap tagMap, + ValueRange tagIndices, ValuePtr numElements) { result.addOperands(tagMemRef); result.addAttribute(getTagMapAttrName(), AffineMapAttr::get(tagMap)); result.addOperands(tagIndices); @@ -1023,7 +1023,7 @@ void AffineDmaWaitOp::build(Builder *builder, OperationState &result, void AffineDmaWaitOp::print(OpAsmPrinter &p) { p << "affine.dma_wait " << *getTagMemRef() << '['; - SmallVector<Value *, 2> operands(getTagIndices()); + SmallVector<ValuePtr, 2> operands(getTagIndices()); p.printAffineMapOfSSAIds(getTagMapAttr(), operands); p << "], "; p.printOperand(getNumElements()); @@ -1068,7 +1068,7 @@ ParseResult AffineDmaWaitOp::parse(OpAsmParser &parser, LogicalResult AffineDmaWaitOp::verify() { if (!getOperand(0)->getType().isa<MemRefType>()) return emitOpError("expected DMA tag to be of memref type"); - for (auto *idx : getTagIndices()) { + for (auto idx : getTagIndices()) { if (!idx->getType().isIndex()) return emitOpError("index to dma_wait must have 'index' type"); if (!isValidAffineIndexOperand(idx)) @@ -1368,7 +1368,7 @@ static LogicalResult foldLoopBounds(AffineForOp forOp) { SmallVector<Attribute, 8> operandConstants; auto boundOperands = lower ? forOp.getLowerBoundOperands() : forOp.getUpperBoundOperands(); - for (auto *operand : boundOperands) { + for (auto operand : boundOperands) { Attribute operandCst; matchPattern(operand, m_Constant(&operandCst)); operandConstants.push_back(operandCst); @@ -1408,8 +1408,8 @@ static LogicalResult foldLoopBounds(AffineForOp forOp) { /// Canonicalize the bounds of the given loop. static LogicalResult canonicalizeLoopBounds(AffineForOp forOp) { - SmallVector<Value *, 4> lbOperands(forOp.getLowerBoundOperands()); - SmallVector<Value *, 4> ubOperands(forOp.getUpperBoundOperands()); + SmallVector<ValuePtr, 4> lbOperands(forOp.getLowerBoundOperands()); + SmallVector<ValuePtr, 4> ubOperands(forOp.getUpperBoundOperands()); auto lbMap = forOp.getLowerBoundMap(); auto ubMap = forOp.getUpperBoundMap(); @@ -1474,7 +1474,7 @@ void AffineForOp::setLowerBound(ValueRange lbOperands, AffineMap map) { assert(lbOperands.size() == map.getNumInputs()); assert(map.getNumResults() >= 1 && "bound map has at least one result"); - SmallVector<Value *, 4> newOperands(lbOperands.begin(), lbOperands.end()); + SmallVector<ValuePtr, 4> newOperands(lbOperands.begin(), lbOperands.end()); auto ubOperands = getUpperBoundOperands(); newOperands.append(ubOperands.begin(), ubOperands.end()); @@ -1487,7 +1487,7 @@ void AffineForOp::setUpperBound(ValueRange ubOperands, AffineMap map) { assert(ubOperands.size() == map.getNumInputs()); assert(map.getNumResults() >= 1 && "bound map has at least one result"); - SmallVector<Value *, 4> newOperands(getLowerBoundOperands()); + SmallVector<ValuePtr, 4> newOperands(getLowerBoundOperands()); newOperands.append(ubOperands.begin(), ubOperands.end()); getOperation()->setOperands(newOperands); @@ -1553,7 +1553,7 @@ bool AffineForOp::matchingBoundOperandList() { unsigned numOperands = lbMap.getNumInputs(); for (unsigned i = 0, e = lbMap.getNumInputs(); i < e; i++) { - // Compare Value *'s. + // Compare ValuePtr 's. if (getOperand(i) != getOperand(numOperands + i)) return false; } @@ -1562,7 +1562,7 @@ bool AffineForOp::matchingBoundOperandList() { Region &AffineForOp::getLoopBody() { return region(); } -bool AffineForOp::isDefinedOutsideOfLoop(Value *value) { +bool AffineForOp::isDefinedOutsideOfLoop(ValuePtr value) { return !region().isAncestor(value->getParentRegion()); } @@ -1573,14 +1573,14 @@ LogicalResult AffineForOp::moveOutOfLoop(ArrayRef<Operation *> ops) { } /// Returns if the provided value is the induction variable of a AffineForOp. -bool mlir::isForInductionVar(Value *val) { +bool mlir::isForInductionVar(ValuePtr val) { return getForInductionVarOwner(val) != AffineForOp(); } /// Returns the loop parent of an induction variable. If the provided value is /// not an induction variable, then return nullptr. -AffineForOp mlir::getForInductionVarOwner(Value *val) { - auto *ivArg = dyn_cast<BlockArgument>(val); +AffineForOp mlir::getForInductionVarOwner(ValuePtr val) { + auto ivArg = dyn_cast<BlockArgument>(val); if (!ivArg || !ivArg->getOwner()) return AffineForOp(); auto *containingInst = ivArg->getOwner()->getParent()->getParentOp(); @@ -1590,7 +1590,7 @@ AffineForOp mlir::getForInductionVarOwner(Value *val) { /// Extracts the induction variables from a list of AffineForOps and returns /// them. void mlir::extractForInductionVars(ArrayRef<AffineForOp> forInsts, - SmallVectorImpl<Value *> *ivs) { + SmallVectorImpl<ValuePtr> *ivs) { ivs->reserve(forInsts.size()); for (auto forInst : forInsts) ivs->push_back(forInst.getInductionVar()); @@ -1729,7 +1729,7 @@ void AffineIfOp::build(Builder *builder, OperationState &result, IntegerSet set, LogicalResult AffineIfOp::fold(ArrayRef<Attribute>, SmallVectorImpl<OpFoldResult> &) { auto set = getIntegerSet(); - SmallVector<Value *, 4> operands(getOperands()); + SmallVector<ValuePtr, 4> operands(getOperands()); canonicalizeSetAndOperands(&set, &operands); // Any canonicalization change always leads to either a reduction in the @@ -1759,7 +1759,8 @@ void AffineLoadOp::build(Builder *builder, OperationState &result, } void AffineLoadOp::build(Builder *builder, OperationState &result, - Value *memref, AffineMap map, ValueRange mapOperands) { + ValuePtr memref, AffineMap map, + ValueRange mapOperands) { assert(map.getNumInputs() == mapOperands.size() && "inconsistent index info"); result.addOperands(memref); result.addOperands(mapOperands); @@ -1769,7 +1770,7 @@ void AffineLoadOp::build(Builder *builder, OperationState &result, } void AffineLoadOp::build(Builder *builder, OperationState &result, - Value *memref, ValueRange indices) { + ValuePtr memref, ValueRange indices) { auto memrefType = memref->getType().cast<MemRefType>(); auto rank = memrefType.getRank(); // Create identity map for memrefs with at least one dimension or () -> () @@ -1825,7 +1826,7 @@ LogicalResult AffineLoadOp::verify() { "expects the number of subscripts to be equal to memref rank"); } - for (auto *idx : getMapOperands()) { + for (auto idx : getMapOperands()) { if (!idx->getType().isIndex()) return emitOpError("index to load must have 'index' type"); if (!isValidAffineIndexOperand(idx)) @@ -1851,7 +1852,7 @@ OpFoldResult AffineLoadOp::fold(ArrayRef<Attribute> cstOperands) { //===----------------------------------------------------------------------===// void AffineStoreOp::build(Builder *builder, OperationState &result, - Value *valueToStore, Value *memref, AffineMap map, + ValuePtr valueToStore, ValuePtr memref, AffineMap map, ValueRange mapOperands) { assert(map.getNumInputs() == mapOperands.size() && "inconsistent index info"); result.addOperands(valueToStore); @@ -1862,7 +1863,7 @@ void AffineStoreOp::build(Builder *builder, OperationState &result, // Use identity map. void AffineStoreOp::build(Builder *builder, OperationState &result, - Value *valueToStore, Value *memref, + ValuePtr valueToStore, ValuePtr memref, ValueRange indices) { auto memrefType = memref->getType().cast<MemRefType>(); auto rank = memrefType.getRank(); @@ -1923,7 +1924,7 @@ LogicalResult AffineStoreOp::verify() { "expects the number of subscripts to be equal to memref rank"); } - for (auto *idx : getMapOperands()) { + for (auto idx : getMapOperands()) { if (!idx->getType().isIndex()) return emitOpError("index to store must have 'index' type"); if (!isValidAffineIndexOperand(idx)) @@ -2072,7 +2073,7 @@ void print(OpAsmPrinter &p, AffinePrefetchOp op) { p << AffinePrefetchOp::getOperationName() << " " << *op.memref() << '['; AffineMapAttr mapAttr = op.getAttrOfType<AffineMapAttr>(op.getMapAttrName()); if (mapAttr) { - SmallVector<Value *, 2> operands(op.getMapOperands()); + SmallVector<ValuePtr, 2> operands(op.getMapOperands()); p.printAffineMapOfSSAIds(mapAttr, operands); } p << ']' << ", " << (op.isWrite() ? "write" : "read") << ", " @@ -2099,7 +2100,7 @@ LogicalResult verify(AffinePrefetchOp op) { return op.emitOpError("too few operands"); } - for (auto *idx : op.getMapOperands()) { + for (auto idx : op.getMapOperands()) { if (!isValidAffineIndexOperand(idx)) return op.emitOpError("index must be a dimension or symbol identifier"); } |