In a region with multiple blocks the verifier will try to look for
dominance and may get successor list for blocks, even though a block
may be empty or does not end with a terminator.
Details
- Reviewers
rriddle GMNGeoffrey - Commits
- rGa6559b42cee2: Fix verifier crashing on some invalid IR
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/IR/Block.cpp | ||
---|---|---|
349 | block->empty is redundant with the llvm::hasSingleElement check. |
mlir/lib/IR/Block.cpp | ||
---|---|---|
349 | Sorry, meant to drop this comment after I actually looked at the commit (with non-tired eyes). |
mlir/test/IR/invalid.mlir | ||
---|---|---|
181–187 | Wait this is all that was needed to repro? How come I wasn't able to extract mhlo.sort from my repro? I thought it required an op with a region that wasn't isolated from above |
mlir/test/IR/invalid.mlir | ||
---|---|---|
181–187 | You sent me two bugs, this is the "small" repro. The larger repro can't be test with opt like that, I would need to write a pass that intentionally create invalid IR and calls the verifier on a nested operation to setup exactly what you have. But the fix here will be enough to cover both test cases. |
Thanks!
mlir/test/IR/invalid.mlir | ||
---|---|---|
181–187 | Yeah I wasn't able to drop the mhlo.sort from even the smaller repro, I thought, but probably I was just doing it wrong :-) |
Interesting!
mlir/lib/IR/Block.cpp | ||
---|---|---|
349 | Nit: *Might* be better more readable with: if (block->empty() || llvm::hasSingleElement(*block->getParent())) return; ... |
mlir/lib/IR/Block.cpp | ||
---|---|---|
349 | Done in 066b3207234d |
block->empty is redundant with the llvm::hasSingleElement check.