diff options
author | River Riddle <riverriddle@google.com> | 2019-08-09 20:07:25 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2019-08-09 20:13:03 -0700 |
commit | 8190fa83a9eff832de762b21cdd1ef3be6ceed08 (patch) | |
tree | 08b161b240cb0cb763cc7e19a088376ce7452367 | |
parent | cb01a295da6787668ce8ccdaeac7fb439afe92e9 (diff) | |
download | tensorflow-8190fa83a9eff832de762b21cdd1ef3be6ceed08.tar.gz |
NFC: Standardize the terminology used for parent ops/regions/etc.
There are currently several different terms used to refer to a parent IR unit in 'get' methods: getParent/getEnclosing/getContaining. This cl standardizes all of these methods to use 'getParent*'.
PiperOrigin-RevId: 262680287
23 files changed, 61 insertions, 67 deletions
diff --git a/tensorflow/compiler/mlir/tensorflow/translate/export_graphdef.cc b/tensorflow/compiler/mlir/tensorflow/translate/export_graphdef.cc index 75d976af44b..a3b1cc94112 100644 --- a/tensorflow/compiler/mlir/tensorflow/translate/export_graphdef.cc +++ b/tensorflow/compiler/mlir/tensorflow/translate/export_graphdef.cc @@ -208,10 +208,8 @@ std::string Exporter::UniqueName(mlir::Operation* op) { StatusOr<std::unique_ptr<NodeDef>> Exporter::GetArgumentNode( mlir::BlockArgument* arg, unsigned index) { auto node_def = absl::make_unique<NodeDef>(); - node_def->set_name(UniqueName(arg->getContainingRegion() - ->getParentOfType<mlir::FuncOp>() - .getName() - .str())); + node_def->set_name(UniqueName( + arg->getParentRegion()->getParentOfType<mlir::FuncOp>().getName().str())); node_def->set_op(FunctionLibraryDefinition::kArgOp); DataType dtype; TF_RETURN_IF_ERROR(ConvertToDataType( @@ -333,7 +331,7 @@ Status Exporter::AddArgumentNode(mlir::BlockArgument* arg, unsigned index) { // is an input node. We recover the original input node and skip adding the // argument node. The new input node will be handled as normal in the // following steps. - if (arg->getContainingRegion()->getParentOfType<mlir::FuncOp>().getName() == + if (arg->getParentRegion()->getParentOfType<mlir::FuncOp>().getName() == "main") { if (!arg->hasOneUse()) { return errors::FailedPrecondition( diff --git a/third_party/mlir/include/mlir/IR/Block.h b/third_party/mlir/include/mlir/IR/Block.h index 50cca52b7ab..84144b89c36 100644 --- a/third_party/mlir/include/mlir/IR/Block.h +++ b/third_party/mlir/include/mlir/IR/Block.h @@ -95,9 +95,8 @@ public: /// Blocks are maintained in a Region. Region *getParent(); - /// Returns the closest surrounding operation that contains this block or - /// nullptr if this is a top-level block. - Operation *getContainingOp(); + /// Returns the closest surrounding operation that contains this block. + Operation *getParentOp(); /// Return if this block is the entry block in the parent region. bool isEntryBlock(); @@ -373,7 +372,7 @@ struct ilist_traits<::mlir::Block> : public ilist_alloc_traits<::mlir::Block> { block_iterator first, block_iterator last); private: - mlir::Region *getContainingRegion(); + mlir::Region *getParentRegion(); }; } // end namespace llvm diff --git a/third_party/mlir/include/mlir/IR/OpDefinition.h b/third_party/mlir/include/mlir/IR/OpDefinition.h index 6c75cb54cfd..ed68936d506 100644 --- a/third_party/mlir/include/mlir/IR/OpDefinition.h +++ b/third_party/mlir/include/mlir/IR/OpDefinition.h @@ -890,10 +890,8 @@ public: /// Return the dialect that this refers to. Dialect *getDialect() { return getOperation()->getDialect(); } - /// Return the Region enclosing this Op. - Region *getContainingRegion() { - return getOperation()->getContainingRegion(); - } + /// Return the parent Region of this operation. + Region *getParentRegion() { return getOperation()->getParentRegion(); } /// Return true if this "op class" can match against the specified operation. /// This hook can be overridden with a more specific implementation in diff --git a/third_party/mlir/include/mlir/IR/Operation.h b/third_party/mlir/include/mlir/IR/Operation.h index 515cd857dd0..db10a1a63ba 100644 --- a/third_party/mlir/include/mlir/IR/Operation.h +++ b/third_party/mlir/include/mlir/IR/Operation.h @@ -116,10 +116,9 @@ public: /// Set the source location the operation was defined or derived from. void setLoc(Location loc) { location = loc; } - /// Returns the region to which the instruction belongs, which can be a - /// function body region or a region that belongs to another operation. - /// Returns nullptr if the instruction is unlinked. - Region *getContainingRegion() const; + /// Returns the region to which the instruction belongs. Returns nullptr if + /// the instruction is unlinked. + Region *getParentRegion(); /// Returns the closest surrounding operation that contains this operation /// or nullptr if this is a top-level operation. diff --git a/third_party/mlir/include/mlir/IR/Region.h b/third_party/mlir/include/mlir/IR/Region.h index 5f21226cd29..c6f97c31fb8 100644 --- a/third_party/mlir/include/mlir/IR/Region.h +++ b/third_party/mlir/include/mlir/IR/Region.h @@ -67,12 +67,12 @@ public: return &Region::blocks; } - /// Return the region containing this region or nullptr if it is a top-level - /// region. - Region *getContainingRegion(); + /// Return the region containing this region or nullptr if the region is + /// attached to a top-level operation. + Region *getParentRegion(); /// Return the parent operation this region is attached to. - Operation *getContainingOp(); + Operation *getParentOp(); /// Find the first parent operation of the given type, or nullptr if there is /// no ancestor operation. @@ -81,7 +81,7 @@ public: do { if (auto parent = dyn_cast_or_null<ParentT>(region->container)) return parent; - } while ((region = region->getContainingRegion())); + } while ((region = region->getParentRegion())); return ParentT(); } diff --git a/third_party/mlir/include/mlir/IR/Value.h b/third_party/mlir/include/mlir/IR/Value.h index 1bad41f4c4c..110c74f41f1 100644 --- a/third_party/mlir/include/mlir/IR/Value.h +++ b/third_party/mlir/include/mlir/IR/Value.h @@ -79,7 +79,7 @@ public: Location getLoc(); /// Return the Region in which this Value is defined. - Region *getContainingRegion(); + Region *getParentRegion(); using use_iterator = ValueUseIterator<OpOperand>; using use_range = llvm::iterator_range<use_iterator>; diff --git a/third_party/mlir/include/mlir/Transforms/RegionUtils.h b/third_party/mlir/include/mlir/Transforms/RegionUtils.h index 5ea79de51aa..a00ddc6ff4c 100644 --- a/third_party/mlir/include/mlir/Transforms/RegionUtils.h +++ b/third_party/mlir/include/mlir/Transforms/RegionUtils.h @@ -31,7 +31,7 @@ namespace mlir { template <typename Range> bool areValuesDefinedAbove(Range values, Region &limit) { for (Value *v : values) - if (!v->getContainingRegion()->isProperAncestor(&limit)) + if (!v->getParentRegion()->isProperAncestor(&limit)) return false; return true; } diff --git a/third_party/mlir/lib/AffineOps/AffineOps.cpp b/third_party/mlir/lib/AffineOps/AffineOps.cpp index 9f347f9c15c..51a6ec2aecf 100644 --- a/third_party/mlir/lib/AffineOps/AffineOps.cpp +++ b/third_party/mlir/lib/AffineOps/AffineOps.cpp @@ -47,7 +47,7 @@ AffineOpsDialect::AffineOpsDialect(MLIRContext *context) /// A utility function to check if a given region is attached to a function. static bool isFunctionRegion(Region *region) { - return llvm::isa<FuncOp>(region->getContainingOp()); + return llvm::isa<FuncOp>(region->getParentOp()); } /// A utility function to check if a value is defined at the top level of a @@ -55,7 +55,7 @@ static bool isFunctionRegion(Region *region) { bool mlir::isTopLevelSymbol(Value *value) { if (auto *arg = dyn_cast<BlockArgument>(value)) return isFunctionRegion(arg->getOwner()->getParent()); - return isFunctionRegion(value->getDefiningOp()->getContainingRegion()); + return isFunctionRegion(value->getDefiningOp()->getParentRegion()); } // Value can be used as a dimension id if it is valid as a symbol, or @@ -68,7 +68,7 @@ bool mlir::isValidDim(Value *value) { if (auto *op = value->getDefiningOp()) { // Top level operation or constant operation is ok. - if (isFunctionRegion(op->getContainingRegion()) || isa<ConstantOp>(op)) + if (isFunctionRegion(op->getParentRegion()) || isa<ConstantOp>(op)) return true; // Affine apply operation is ok if all of its operands are ok. if (auto applyOp = dyn_cast<AffineApplyOp>(op)) @@ -93,7 +93,7 @@ bool mlir::isValidSymbol(Value *value) { if (auto *op = value->getDefiningOp()) { // Top level operation or constant operation is ok. - if (isFunctionRegion(op->getContainingRegion()) || isa<ConstantOp>(op)) + if (isFunctionRegion(op->getParentRegion()) || isa<ConstantOp>(op)) return true; // Affine apply operation is ok if all of its operands are ok. if (auto applyOp = dyn_cast<AffineApplyOp>(op)) @@ -1447,7 +1447,7 @@ AffineForOp mlir::getForInductionVarOwner(Value *val) { auto *ivArg = dyn_cast<BlockArgument>(val); if (!ivArg || !ivArg->getOwner()) return AffineForOp(); - auto *containingInst = ivArg->getOwner()->getParent()->getContainingOp(); + auto *containingInst = ivArg->getOwner()->getParent()->getParentOp(); return dyn_cast<AffineForOp>(containingInst); } diff --git a/third_party/mlir/lib/Analysis/AffineAnalysis.cpp b/third_party/mlir/lib/Analysis/AffineAnalysis.cpp index 006cc2cecf2..28c4eae941e 100644 --- a/third_party/mlir/lib/Analysis/AffineAnalysis.cpp +++ b/third_party/mlir/lib/Analysis/AffineAnalysis.cpp @@ -548,8 +548,8 @@ static Block *getCommonBlock(const MemRefAccess &srcAccess, unsigned numCommonLoops) { if (numCommonLoops == 0) { auto *block = srcAccess.opInst->getBlock(); - while (!llvm::isa<FuncOp>(block->getContainingOp())) { - block = block->getContainingOp()->getBlock(); + while (!llvm::isa<FuncOp>(block->getParentOp())) { + block = block->getParentOp()->getBlock(); } return block; } diff --git a/third_party/mlir/lib/Analysis/Dominance.cpp b/third_party/mlir/lib/Analysis/Dominance.cpp index fc62048d412..e384a56a71d 100644 --- a/third_party/mlir/lib/Analysis/Dominance.cpp +++ b/third_party/mlir/lib/Analysis/Dominance.cpp @@ -70,7 +70,7 @@ bool DominanceInfoBase<IsPostDom>::properlyDominates(Block *a, Block *b) { if (regionA != regionB) { Operation *bAncestor; do { - bAncestor = regionB->getContainingOp(); + bAncestor = regionB->getParentOp(); // If 'bAncestor' is the top level region, then 'a' is a block that post // dominates 'b'. if (!bAncestor || !bAncestor->getBlock()) diff --git a/third_party/mlir/lib/Analysis/Utils.cpp b/third_party/mlir/lib/Analysis/Utils.cpp index 3de509dd0d3..fc36cc58f8e 100644 --- a/third_party/mlir/lib/Analysis/Utils.cpp +++ b/third_party/mlir/lib/Analysis/Utils.cpp @@ -449,7 +449,7 @@ static void findInstPosition(Operation *op, Block *limitBlock, // rely on linear scans. int instPosInBlock = std::distance(block->begin(), op->getIterator()); positions->push_back(instPosInBlock); - op = block->getContainingOp(); + op = block->getParentOp(); block = op->getBlock(); } std::reverse(positions->begin(), positions->end()); diff --git a/third_party/mlir/lib/Dialect/LoopOps/LoopOps.cpp b/third_party/mlir/lib/Dialect/LoopOps/LoopOps.cpp index 63e0da029c7..13dc35ec7ce 100644 --- a/third_party/mlir/lib/Dialect/LoopOps/LoopOps.cpp +++ b/third_party/mlir/lib/Dialect/LoopOps/LoopOps.cpp @@ -118,7 +118,7 @@ ForOp mlir::loop::getForInductionVarOwner(Value *val) { if (!ivArg) return ForOp(); assert(ivArg->getOwner() && "unlinked block argument"); - auto *containingInst = ivArg->getOwner()->getContainingOp(); + auto *containingInst = ivArg->getOwner()->getParentOp(); return dyn_cast_or_null<ForOp>(containingInst); } diff --git a/third_party/mlir/lib/IR/AsmPrinter.cpp b/third_party/mlir/lib/IR/AsmPrinter.cpp index 31d45bd5674..a137f265064 100644 --- a/third_party/mlir/lib/IR/AsmPrinter.cpp +++ b/third_party/mlir/lib/IR/AsmPrinter.cpp @@ -1713,14 +1713,14 @@ void Operation::print(raw_ostream &os) { return; } - auto region = getContainingRegion(); + auto region = getParentRegion(); if (!region) { os << "<<UNLINKED INSTRUCTION>>\n"; return; } // Get the top-level region. - while (auto *nextRegion = region->getContainingRegion()) + while (auto *nextRegion = region->getParentRegion()) region = nextRegion; ModuleState state(getContext()); @@ -1741,7 +1741,7 @@ void Block::print(raw_ostream &os) { } // Get the top-level region. - while (auto *nextRegion = region->getContainingRegion()) + while (auto *nextRegion = region->getParentRegion()) region = nextRegion; ModuleState state(region->getContext()); @@ -1760,7 +1760,7 @@ void Block::printAsOperand(raw_ostream &os, bool printType) { } // Get the top-level region. - while (auto *nextRegion = region->getContainingRegion()) + while (auto *nextRegion = region->getParentRegion()) region = nextRegion; ModuleState state(region->getContext()); diff --git a/third_party/mlir/lib/IR/Block.cpp b/third_party/mlir/lib/IR/Block.cpp index efa76548a88..28614ca8bdc 100644 --- a/third_party/mlir/lib/IR/Block.cpp +++ b/third_party/mlir/lib/IR/Block.cpp @@ -49,9 +49,9 @@ Block::~Block() { Region *Block::getParent() { return parentValidInstOrderPair.getPointer(); } /// Returns the closest surrounding operation that contains this block or -/// nullptr if this is a top-level operation block. -Operation *Block::getContainingOp() { - return getParent() ? getParent()->getContainingOp() : nullptr; +/// nullptr if this block is unlinked. +Operation *Block::getParentOp() { + return getParent() ? getParent()->getParentOp() : nullptr; } /// Return if this block is the entry block in the parent region. diff --git a/third_party/mlir/lib/IR/Operation.cpp b/third_party/mlir/lib/IR/Operation.cpp index 267b9c26ba7..fa2ce8cb1ba 100644 --- a/third_party/mlir/lib/IR/Operation.cpp +++ b/third_party/mlir/lib/IR/Operation.cpp @@ -273,12 +273,12 @@ Dialect *Operation::getDialect() { return getContext()->getRegisteredDialect(getName().getDialect()); } -Region *Operation::getContainingRegion() const { +Region *Operation::getParentRegion() { return block ? block->getParent() : nullptr; } Operation *Operation::getParentOp() { - return block ? block->getContainingOp() : nullptr; + return block ? block->getParentOp() : nullptr; } /// Replace any uses of 'from' with 'to' within this operation. @@ -858,7 +858,7 @@ static LogicalResult verifyBBArguments(Operation::operand_range operands, } static LogicalResult verifyTerminatorSuccessors(Operation *op) { - auto *parent = op->getContainingRegion(); + auto *parent = op->getParentRegion(); // Verify that the operands lines up with the BB arguments in the successor. for (unsigned i = 0, e = op->getNumSuccessors(); i != e; ++i) { diff --git a/third_party/mlir/lib/IR/Region.cpp b/third_party/mlir/lib/IR/Region.cpp index 551d59ca96f..0947ddd04f3 100644 --- a/third_party/mlir/lib/IR/Region.cpp +++ b/third_party/mlir/lib/IR/Region.cpp @@ -42,18 +42,18 @@ Location Region::getLoc() { return container->getLoc(); } -Region *Region::getContainingRegion() { +Region *Region::getParentRegion() { assert(container && "region is not attached to a container"); - return container->getContainingRegion(); + return container->getParentRegion(); } -Operation *Region::getContainingOp() { return container; } +Operation *Region::getParentOp() { return container; } bool Region::isProperAncestor(Region *other) { if (this == other) return false; - while ((other = other->getContainingRegion())) { + while ((other = other->getParentRegion())) { if (this == other) return true; } @@ -64,7 +64,7 @@ bool Region::isProperAncestor(Region *other) { unsigned Region::getRegionNumber() { // Regions are always stored consecutively, so use pointer subtraction to // figure out what number this is. - return this - &getContainingOp()->getRegions()[0]; + return this - &getParentOp()->getRegions()[0]; } /// Clone the internal blocks from this region into `dest`. Any @@ -145,7 +145,7 @@ static bool isIsolatedAbove(Region ®ion, Region &limit, for (Value *operand : op.getOperands()) { // 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->getContainingRegion()->isProperAncestor(&limit)) { + if (operand->getParentRegion()->isProperAncestor(&limit)) { if (noteLoc) { op.emitOpError("using value defined outside the region") .attachNote(noteLoc) @@ -175,7 +175,7 @@ void Region::walk(llvm::function_ref<void(Operation *)> callback) { block.walk(callback); } -Region *llvm::ilist_traits<::mlir::Block>::getContainingRegion() { +Region *llvm::ilist_traits<::mlir::Block>::getParentRegion() { size_t Offset( size_t(&((Region *)nullptr->*Region::getSublistAccess(nullptr)))); iplist<Block> *Anchor(static_cast<iplist<Block> *>(this)); @@ -186,7 +186,7 @@ Region *llvm::ilist_traits<::mlir::Block>::getContainingRegion() { /// We keep the region pointer up to date. void llvm::ilist_traits<::mlir::Block>::addNodeToList(Block *block) { assert(!block->getParent() && "already in a region!"); - block->parentValidInstOrderPair.setPointer(getContainingRegion()); + block->parentValidInstOrderPair.setPointer(getParentRegion()); } /// This is a trait method invoked when an operation is removed from a @@ -202,8 +202,8 @@ void llvm::ilist_traits<::mlir::Block>::transferNodesFromList( ilist_traits<Block> &otherList, block_iterator first, block_iterator last) { // If we are transferring operations within the same function, the parent // pointer doesn't need to be updated. - auto *curParent = getContainingRegion(); - if (curParent == otherList.getContainingRegion()) + auto *curParent = getParentRegion(); + if (curParent == otherList.getParentRegion()) return; // Update the 'parent' member of each Block. diff --git a/third_party/mlir/lib/IR/Value.cpp b/third_party/mlir/lib/IR/Value.cpp index 4fa49213a3f..4ad1460e90b 100644 --- a/third_party/mlir/lib/IR/Value.cpp +++ b/third_party/mlir/lib/IR/Value.cpp @@ -35,12 +35,12 @@ Location Value::getLoc() { } /// Return the Region in which this Value is defined. -Region *Value::getContainingRegion() { +Region *Value::getParentRegion() { switch (getKind()) { case Value::Kind::BlockArgument: return cast<BlockArgument>(this)->getOwner()->getParent(); case Value::Kind::OpResult: - return getDefiningOp()->getContainingRegion(); + return getDefiningOp()->getParentRegion(); } llvm_unreachable("Unknown Value Kind"); } diff --git a/third_party/mlir/lib/Transforms/AffineDataCopyGeneration.cpp b/third_party/mlir/lib/Transforms/AffineDataCopyGeneration.cpp index c4dec159190..522ed4a4c09 100644 --- a/third_party/mlir/lib/Transforms/AffineDataCopyGeneration.cpp +++ b/third_party/mlir/lib/Transforms/AffineDataCopyGeneration.cpp @@ -249,7 +249,7 @@ static bool getFullMemRefAsRegion(Operation *opInst, unsigned numParamLoopIVs, static InFlightDiagnostic LLVM_ATTRIBUTE_UNUSED emitRemarkForBlock(Block &block) { - return block.getContainingOp()->emitRemark(); + return block.getParentOp()->emitRemark(); } /// Generates a point-wise copy from/to `memref' to/from `fastMemRef' and @@ -872,7 +872,7 @@ uint64_t AffineDataCopyGeneration::runOnBlock(Block::iterator begin, if (totalCopyBuffersSizeInBytes > fastMemCapacityBytes) { StringRef str = "Total size of all copy buffers' for this block " "exceeds fast memory capacity\n"; - block->getContainingOp()->emitError(str); + block->getParentOp()->emitError(str); } return totalCopyBuffersSizeInBytes; diff --git a/third_party/mlir/lib/Transforms/Utils/FoldUtils.cpp b/third_party/mlir/lib/Transforms/Utils/FoldUtils.cpp index 1a68a50be8f..435ea85ea98 100644 --- a/third_party/mlir/lib/Transforms/Utils/FoldUtils.cpp +++ b/third_party/mlir/lib/Transforms/Utils/FoldUtils.cpp @@ -32,11 +32,11 @@ using namespace mlir; /// Given an operation, find the parent region that folded constants should be /// inserted into. static Region *getInsertionRegion(Operation *op) { - while (Region *region = op->getContainingRegion()) { + while (Region *region = op->getParentRegion()) { // Insert in this region for any of the following scenarios: // * The parent is unregistered, or is known to be isolated from above. // * The parent is a top-level operation. - auto *parentOp = region->getContainingOp(); + auto *parentOp = region->getParentOp(); if (!parentOp->isRegistered() || parentOp->isKnownIsolatedFromAbove() || !parentOp->getBlock()) return region; diff --git a/third_party/mlir/lib/Transforms/Utils/RegionUtils.cpp b/third_party/mlir/lib/Transforms/Utils/RegionUtils.cpp index e9cb11a8ece..a2b4fe3c83f 100644 --- a/third_party/mlir/lib/Transforms/Utils/RegionUtils.cpp +++ b/third_party/mlir/lib/Transforms/Utils/RegionUtils.cpp @@ -27,7 +27,7 @@ using namespace mlir; void mlir::replaceAllUsesInRegionWith(Value *orig, Value *replacement, Region ®ion) { for (IROperand &use : llvm::make_early_inc_range(orig->getUses())) { - if (region.isAncestor(use.getOwner()->getContainingRegion())) + if (region.isAncestor(use.getOwner()->getParentRegion())) use.set(replacement); } } @@ -40,8 +40,8 @@ void mlir::getUsedValuesDefinedAbove(Region ®ion, Region &limit, // Collect proper ancestors of `limit` upfront to avoid traversing the region // tree for every value. llvm::SmallPtrSet<Region *, 4> properAncestors; - for (auto *reg = limit.getContainingRegion(); reg != nullptr; - reg = reg->getContainingRegion()) { + for (auto *reg = limit.getParentRegion(); reg != nullptr; + reg = reg->getParentRegion()) { properAncestors.insert(reg); } @@ -49,7 +49,7 @@ void mlir::getUsedValuesDefinedAbove(Region ®ion, Region &limit, for (Value *operand : op->getOperands()) // Collect values that are used by an operation and defined in a proper // ancestor of region. - if (properAncestors.count(operand->getContainingRegion())) + if (properAncestors.count(operand->getParentRegion())) values.insert(operand); }); } diff --git a/third_party/mlir/test/lib/TestDialect/TestPatterns.cpp b/third_party/mlir/test/lib/TestDialect/TestPatterns.cpp index 666c92f8497..584ff996fca 100644 --- a/third_party/mlir/test/lib/TestDialect/TestPatterns.cpp +++ b/third_party/mlir/test/lib/TestDialect/TestPatterns.cpp @@ -66,7 +66,7 @@ struct TestRegionRewriteBlockMovement : public ConversionPattern { matchAndRewrite(Operation *op, ArrayRef<Value *> operands, ConversionPatternRewriter &rewriter) const final { // Inline this region into the parent region. - auto &parentRegion = *op->getContainingRegion(); + auto &parentRegion = *op->getParentRegion(); rewriter.inlineRegionBefore(op->getRegion(0), parentRegion, parentRegion.end()); diff --git a/third_party/mlir/test/lib/Transforms/TestLoopMapping.cpp b/third_party/mlir/test/lib/Transforms/TestLoopMapping.cpp index fb1ef64d26f..bf354670f92 100644 --- a/third_party/mlir/test/lib/Transforms/TestLoopMapping.cpp +++ b/third_party/mlir/test/lib/Transforms/TestLoopMapping.cpp @@ -51,7 +51,7 @@ public: func.walk<loop::ForOp>([&processorIds, &numProcessors](loop::ForOp op) { // Ignore nested loops. - if (op.getContainingRegion()->getParentOfType<loop::ForOp>()) + if (op.getParentRegion()->getParentOfType<loop::ForOp>()) return; mapLoopToProcessorIds(op, processorIds, numProcessors); }); diff --git a/third_party/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp b/third_party/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp index 0f13e5ee2fa..d30eacc044d 100644 --- a/third_party/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp +++ b/third_party/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp @@ -45,7 +45,7 @@ public: FuncOp func = getFunction(); func.walk<loop::ForOp>([this](loop::ForOp op) { // Ignore nested loops. - if (op.getContainingRegion()->getParentOfType<loop::ForOp>()) + if (op.getParentRegion()->getParentOfType<loop::ForOp>()) return; extractFixedOuterLoops(op, sizes); }); |