[PATCH] D78296: [MLIR] NFC use Operation::getParentWithTrait in alloca verifier
Uday Bondhugula via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 16 09:28:26 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdfcc403b2d78: [MLIR] NFC use Operation::getParentWithTrait in alloca verifier (authored by bondhugula).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78296/new/
https://reviews.llvm.org/D78296
Files:
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
Index: mlir/lib/Dialect/StandardOps/IR/Ops.cpp
===================================================================
--- mlir/lib/Dialect/StandardOps/IR/Ops.cpp
+++ mlir/lib/Dialect/StandardOps/IR/Ops.cpp
@@ -324,14 +324,11 @@
return success();
// An alloca op needs to have an ancestor with an allocation scope trait.
- auto *parentOp = op.getParentOp();
- while (parentOp) {
- if (parentOp->template hasTrait<OpTrait::AutomaticAllocationScope>())
- return success();
- parentOp = parentOp->getParentOp();
- }
- return op.emitOpError(
- "requires an ancestor op with AutomaticAllocationScope trait");
+ if (!op.template getParentWithTrait<OpTrait::AutomaticAllocationScope>())
+ return op.emitOpError(
+ "requires an ancestor op with AutomaticAllocationScope trait");
+
+ return success();
}
namespace {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78296.258074.patch
Type: text/x-patch
Size: 849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200416/20bba5cc/attachment.bin>
More information about the llvm-commits
mailing list