[clang] [CIR] Keep cir.cleanup.scope cleanup regions reachable (PR #232217)
Steffen Larsen via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 28 02:37:46 PDT 2026
================
@@ -2069,31 +2096,30 @@ LogicalResult cir::CleanupScopeOp::verify() {
void cir::CleanupScopeOp::getSuccessorRegions(
mlir::RegionBranchPoint point, SmallVectorImpl<RegionSuccessor> ®ions) {
- // Execution always starts in the body region.
+ // The cleanup can also run from the middle of the body, on an unwind out of
+ // a call or on a cir.return, cir.break, cir.continue or cir.goto. None of
+ // these is a branch point, so the cleanup region is a successor of the
+ // parent and of every body exit to stand in for them.
if (point.isParent()) {
regions.emplace_back(&getBodyRegion());
----------------
steffenlarsen wrote:
I'm a sucker for a good reservation.
```suggestion
regions.reserve(regions.size() + 2);
regions.emplace_back(&getBodyRegion());
```
https://github.com/llvm/llvm-project/pull/232217
More information about the cfe-commits
mailing list