[Mlir-commits] [mlir] dfcc403 - [MLIR] NFC use Operation::getParentWithTrait in alloca verifier
Uday Bondhugula
llvmlistbot at llvm.org
Thu Apr 16 09:05:29 PDT 2020
Author: Uday Bondhugula
Date: 2020-04-16T21:34:02+05:30
New Revision: dfcc403b2d78e9b2e8aec788445b9add5ed0ac7a
URL: https://github.com/llvm/llvm-project/commit/dfcc403b2d78e9b2e8aec788445b9add5ed0ac7a
DIFF: https://github.com/llvm/llvm-project/commit/dfcc403b2d78e9b2e8aec788445b9add5ed0ac7a.diff
LOG: [MLIR] NFC use Operation::getParentWithTrait in alloca verifier
Use recently added accessor Operation::getParentWithTrait in alloca
verifier.
Differential Revision: https://reviews.llvm.org/D78296
Added:
Modified:
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
index 53870e414c19..452dade61e32 100644
--- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
+++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
@@ -324,14 +324,11 @@ static LogicalResult verify(AllocLikeOp op) {
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 {
More information about the Mlir-commits
mailing list