[Mlir-commits] [mlir] Reland "[mlir][reducer] Add eraseRedundantBlocksInRegion and getSuccessorForwardOperands API to BranchOpInterface" (PR #189253)
Mehdi Amini
llvmlistbot at llvm.org
Mon Apr 6 14:37:55 PDT 2026
joker-eph wrote:
Hi @google-yfyang,
```
Operation *isolatedParent = region.getParentOp();
if (!isolatedParent->hasTrait<OpTrait::IsIsolatedFromAbove>()) {
isolatedParent =
isolatedParent->getParentWithTrait<OpTrait::IsIsolatedFromAbove>();
}
```
I would add the `getParentWithTrait` method to the Region class so this could be just:
```
Operation *isolatedParent = region.getParentWithTrait<OpTrait::IsIsolatedFromAbove>();
```
Otherwise that seems to make the usage conforming to the API requirement indeed.
https://github.com/llvm/llvm-project/pull/189253
More information about the Mlir-commits
mailing list