feat(joinir): Phase 132-P3 - Exit PHI collision early detection
Added verify_exit_phi_no_collision() to contract_checks.rs for early detection of ValueId collisions between exit PHIs and other instructions. Problem detected: - If exit_phi_builder uses builder.value_gen.next() (module-level) instead of func.next_value_id() (function-level), ValueIds can collide: Example: - bb0: %1 = const 0 (counter init) - bb3: %1 = phi ... (exit PHI - collision!) Previous behavior: - Error only detected at LLVM backend runtime - Cryptic error: "Cannot overwrite PHI dst=1" New behavior: - Panic at Rust compile time (debug build) - Clear error message with fix suggestion: "Exit PHI dst %1 collides with instruction in block 0 Fix: Use func.next_value_id() in exit_phi_builder.rs" Benefits: - 🔥 Fail-Fast: Catch errors during Rust compilation, not LLVM execution - 📋 Clear messages: Exact collision point + fix suggestion - 🧪 Testable: verify_exit_phi_no_collision() can be unit tested 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -9,6 +9,12 @@
|
||||
- 結果: `/tmp/p1_return_i.hako` が 3 を返す(VM 一致)
|
||||
- 詳細: `investigations/phase132-llvm-exit-phi-wrong-result.md`
|
||||
|
||||
**追加(Phase 132-P2): Case C の Exit PHI ValueId 衝突を修正**
|
||||
- 原因: `exit_phi_builder.rs` が module-level allocator を使い、同一関数内で ValueId が衝突し得た
|
||||
- 修正: `func.next_value_id()`(function-level)へ統一(`bd07b7f4`)
|
||||
- 結果: `apps/tests/llvm_stage3_loop_only.hako` が LLVM EXE でも `Result: 3`(VM 一致)
|
||||
- 詳細: `investigations/phase132-case-c-llvm-exe.md`
|
||||
|
||||
## 2025‑12‑14:現状サマリ
|
||||
|
||||
(補足)docs が増えて迷子になったときの「置き場所ルール(SSOT)」:
|
||||
|
||||
Reference in New Issue
Block a user