[Mlir-commits] [mlir] [mlir][RegionBranchOpInterface] explicitly check for existance of block terminator (PR #76831)
Mehdi Amini
llvmlistbot at llvm.org
Thu Jan 4 06:16:53 PST 2024
================
@@ -177,9 +177,10 @@ LogicalResult detail::verifyTypesAlongControlFlowEdges(Operation *op) {
SmallVector<RegionBranchTerminatorOpInterface> regionReturnOps;
for (Block &block : region)
- if (auto terminator = dyn_cast<RegionBranchTerminatorOpInterface>(
- block.getTerminator()))
- regionReturnOps.push_back(terminator);
+ if (block.mightHaveTerminator())
+ if (auto terminator = dyn_cast<RegionBranchTerminatorOpInterface>(
+ block.getTerminator()))
----------------
joker-eph wrote:
Could spell this more directly/cheaply:
```suggestion
if (!block.empty())
if (auto terminator = dyn_cast<RegionBranchTerminatorOpInterface>(
block.back()))
```
https://github.com/llvm/llvm-project/pull/76831
More information about the Mlir-commits
mailing list