forked from OSchip/llvm-project
[MLIR] NFC use Operation::getParentWithTrait in alloca verifier
Use recently added accessor Operation::getParentWithTrait in alloca verifier. Differential Revision: https://reviews.llvm.org/D78296
This commit is contained in:
parent
8812b0cc5c
commit
dfcc403b2d
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue