================
@@ -2069,31 +2096,30 @@ LogicalResult cir::CleanupScopeOp::verify() {
 
 void cir::CleanupScopeOp::getSuccessorRegions(
     mlir::RegionBranchPoint point, SmallVectorImpl<RegionSuccessor> &regions) {
-  // 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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to