================
@@ -701,10 +701,21 @@ void cir::ConditionOp::getSuccessorRegions(
     return;
   }
 
-  // Parent is an await: condition may branch to resume or suspend regions.
+  // Parent is an await: condition in ready region branches to resume or
+  // suspend regions. Condition in suspend region branches to resume (veto) or
+  // exits to parent op (suspend).
   auto await = cast<AwaitOp>(getOperation()->getParentOp());
-  regions.emplace_back(&await.getResume());
-  regions.emplace_back(&await.getSuspend());
+  mlir::Region *parentRegion = getOperation()->getBlock()->getParent();
+  if (parentRegion == &await.getReady()) {
+    regions.emplace_back(&await.getResume());
+    regions.emplace_back(&await.getSuspend());
+    return;
+  }
+  if (parentRegion == &await.getSuspend()) {
----------------
bcardosolopes wrote:

The other two cases list the region taken when the condition is true first: 
`body` for loops, `resume` for the ready region. Here true means suspend, i.e. 
exit to the parent, but `resume` is listed first. Please swap them so all three 
agree, otherwise whoever implements the TODO above (folding a constant 
condition to narrow the successors) gets this one backwards.

https://github.com/llvm/llvm-project/pull/227527
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to