-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[PROTON] Refactor scope id allocation to allow flexible annotations #8613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| DenseSet<VirtualBlock> exitVirtualBlocks; | ||
| while (!virtualBlockList.empty()) { | ||
| VirtualBlock &virtualBlock = virtualBlockList.front(); | ||
| virtualBlockList.pop_front(); | ||
| // Evaluate the transfer function for this block starting from the cached | ||
| // input state. | ||
| auto inputBlockInfo = inputBlockInfoMap[virtualBlock]; | ||
| SmallVector<VirtualBlock> successors; | ||
| Block::iterator startIt = virtualBlock.second.isValid() | ||
| ? std::next(virtualBlock.second) | ||
| : virtualBlock.first->begin(); | ||
| for (Operation &op : llvm::make_range(startIt, virtualBlock.first->end())) { | ||
| if (op.hasTrait<OpTrait::IsTerminator>() || | ||
| isa<RegionBranchOpInterface>(op)) { | ||
| visitTerminator(&op, successors); | ||
| break; | ||
| } | ||
| if (auto recordOp = dyn_cast<RecordOp>(&op)) { | ||
| auto scopeId = opToIdMap.lookup(recordOp); | ||
| if (recordOp.getIsStart()) { | ||
| inputBlockInfo.insert(scopeId); | ||
| } else { | ||
| inputBlockInfo.erase(scopeId); | ||
| } | ||
| } | ||
| } | ||
| if (successors.empty()) { | ||
| exitVirtualBlocks.insert(virtualBlock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Report scopes left open when exiting the function
The reachability stage tracks exit blocks in exitVirtualBlocks (lines ~173‑200) but never inspects the active scope set when those blocks are reached. As written, the loop only diagnoses mismatched proton.record operations inside individual blocks (lines ~216‑243); it never emits a diagnostic if a scope is still active when control leaves the function. This means a scope that starts before a conditional and only ends on one branch will silently pass analysis even though the other branch exits with the scope open, leading to inconsistent instrumentation at runtime.
Useful? React with 👍 / 👎.
No description provided.