Repository navigation
Description
Current evidence
Audit baseline: master 3ac33ec1, after #11. Source: ir/src/verifier.rs:161.
Static inspection: phi inputs are treated as ordinary sequential uses. Incoming block IDs, predecessor completeness, duplicate edges and incoming types are not checked; valid backedge definitions may be rejected solely because their block is stored later.
Scope
Difficulty: high.
Give phi nodes edge-specific validation and a defined placement rule. Coordinate with CFG/dominance validation without combining unrelated instruction checks.
Completion criteria
- Incoming blocks correspond to actual predecessor edges.
- Duplicate/missing incoming edges and wrong incoming types fail.
- A valid loop phi referencing a backedge value passes.
- Tests reorder blocks while preserving the CFG.
Dependencies and boundaries
Backlog index: #12. This issue owns only the bounded work described above.
Approved D11 contract — 2026-09-23
The maintainer approved the following CFG rules:
- Phi instructions form a prefix at the beginning of a block.
- Each phi has exactly one input for each distinct predecessor block, even if that predecessor has repeated successor edges.
- The function entry block has neither phi instructions nor predecessor edges. Reject entry self-loops and incoming edges from reachable or unreachable blocks, for br, conditional branches, and switch destinations.
- Ordinary loops use separate loop-header blocks and remain supported, including valid backedge phi inputs.
- Verification preserves the original O0 module without rewriting or removing its blocks.
These requirements are implemented in the local foundation work and have regression coverage, including block-order permutations. They are not yet committed or merged; this issue remains open.
Activity