We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8812b0c commit dfcc403Copy full SHA for dfcc403
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
@@ -324,14 +324,11 @@ static LogicalResult verify(AllocLikeOp op) {
324
return success();
325
326
// An alloca op needs to have an ancestor with an allocation scope trait.
327
- auto *parentOp = op.getParentOp();
328
- while (parentOp) {
329
- if (parentOp->template hasTrait<OpTrait::AutomaticAllocationScope>())
330
- return success();
331
- parentOp = parentOp->getParentOp();
332
- }
333
- return op.emitOpError(
334
- "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();
335
}
336
337
namespace {
0 commit comments