[clang] [ClangIR] Support bool-returning await_suspend (PR #227527)
Aman Maurya via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 29 20:55:09 PDT 2026
================
@@ -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()) {
----------------
amanmaurya92 wrote:
Done! I swapped the successor ordering so getOperation() (condition true / exit to parent) is listed first and resume (condition false) is second. Thanks!
https://github.com/llvm/llvm-project/pull/227527
More information about the cfe-commits
mailing list