Go CFG: remove dead "send" additional node#22050
Draft
Copilot wants to merge 1 commit into
Draft
Conversation
Copilot
AI
changed the title
[WIP] Investigate additional nodes in ControlFlowGraphShared.qll
Clarify Jun 25, 2026
additionalNode target for shared CFG minimization (no code change)
Copilot
AI
changed the title
Clarify
Go CFG: remove dead Jun 25, 2026
additionalNode target for shared CFG minimization (no code change)"send" additional node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Investigation into minimizing the additional CFG nodes produced by
predicate additionalNodeingo/ql/lib/semmle/go/controlflow/ControlFlowGraphShared.qll, comparing against Java/C# which share the same CFG library.Findings
IR::Instruction), so the additional nodes encode IR semantics (assignment writes, tuple extraction, zero-init, parameter/argument binding, implicit derefs/bounds, promoted-field reads, …) that the data-flow library depends on. These are genuinely required."send"node is the sole exception: nostepwires it into the graph, so it is unreachable (0 reachable nodes on the test DB). The send is already modeled by theSendStmt's ownisInnode, and the only consumer of the dead node — theSendInstructionIR class — was unused except fortoString.Changes
ControlFlowGraphShared.qll: drop the dead"send"branch fromadditionalNode.IR.qll: remove the unusedSendInstructionclass and itsgetInsnKindbranch.CFG and IR library tests are unchanged (empty
.expecteddiffs), consistent with the removed node being unreachable.Original prompt
Starting from this branch (copilot/vscode-mndb17m3-9fpv), look at
[Chronological Review: The conversation began with the user requesting to explore the possibility of using more default behavior from the shared control flow graph (CFG) library for Go's select statements. The user then decided to keep the CFG for select clauses language-specific due to existing problems and requested an investigation into the correctness of successor types on edges. The user later asked to check the git history for the main branch to understand the CFG better. The focus shifted to examining the `predicate additionalNode` in the shared CFG library to minimize additional nodes and compare implementations with Java and C#. The conversation culminated in the user specifying the current file and selection context for further investigation.]predicate additionalNodeingo/ql/lib/semmle/go/controlflow/ControlFlowGraphShared.qll. We want to use as few additional nodes as possible. Investigate if we need all of the additional nodes. You can also compare how java and C# (which are the languages using this shared CFG library) do things.[Intent Mapping:
predicate additionalNode..." - Direct investigation into minimizing additional nodes in the CFG.][Technical Inventory:
[Code Archaeology:
predicate additionalNodewhich is under investigation for optimization.][Progress Assessment:
[Context Validation: All critical information for continuation is captured, including user decisions and specific areas of focus for code investigation.]
[Recent Commands Analysis:
predicate additionalNodein ControlFlowGraphShared.qll and compare with Java and C# implementations.predicate additionalNodeand its implementation details.predicate additionalNodein the context of minimizing additional nodes in the CFG.1. Conversation Overview: - Primary Objectives: - "Is there any way to use more of the default behaviour of the shared library...?" - Explore shared CFG behavior for Go. - "Okay, let's keep the CFG for select clauses language-specific then." - Confirm decision to maintain language-specific CFG for select clauses. - "You should have git history available to look what the cfg looks like on main." - Review git history for CFG insights. - "Starting from this branch... look at `predicate additionalNode`..." - Investigate minimizing additional nodes in the CFG. - Session Context: The conversation flowed from exploring shared library behavior to confirming language-specific implementations and investigating specific predicates in the CFG. - User Intent Evolution: The user shifted from exploring shared behavior to focusing on optimizing the existing language-specific CFG for Go.- Technical Foundation:
- Repository: codeql
- Branch: copilot/vscode-mndb17m3-9fpv
- Default branch: main
- Key files: ControlFlowGraph.qll, ControlFlowGraphShared.qll
- Codebase Status:
- File: ControlFlowGraph.qll
- Purpose: Models language-specific edges for Go select statements.
- Current State: Under review for potential integration with shared library behavior.
- File: ControlFlowGraphShared.qll
- Purpose: Contains shared CFG logic and predicates.
- Current State: Focus on
- Problem Resolution:
- Issues Encountered: Potential problems with the current CFG implementation for select statements and correctness of successor types.
- Solutions Implemented: Decision to keep select clauses language-specific while investigating improvements.
- D...
predicate additionalNodefor optimization.Created from VS Code.