Files
hakorune/src/mir/phi_core/conservative.rs
nyash-codex c10ffa4c2b refactor(phi): Phase 58 ConservativeMerge inline into merge_all_vars
Phase 58: ConservativeMerge 本体削除

## 変更内容

- ConservativeMerge::analyze を phi_merge.rs の merge_all_vars 内にインライン化
- conservative.rs から struct と impl を削除(約95行削減)
- conservative.rs はドキュメントコメントのみ残す

## 技術的詳細

- all_vars: 全ブランチの変数ユニオン(Conservative戦略)
- changed_vars: 実際に変更された変数(決定的順序のためBTreeSet使用)
- Conservative ∘ Elimination = Minimal SSA 理論コメント保持

## 削減効果

- conservative.rs: 149行 → 57行(92行削減、62%削減)
- ConservativeMerge struct 完全削除
- テストコード 35行削除

## テスト結果

- JoinIR: 56 passed / 0 failed
- PHI関連テスト: 全PASS

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 09:14:24 +09:00

57 lines
1.8 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//! Conservative PHI Generation - Box Theory Application
//!
//! # Theory: Conservative ∘ Elimination = Minimal SSA
//!
//! - Conservative: correctness-first, generate all PHIs
//! - Elimination (future): efficiency optimization, remove unused PHIs
//!
//! # Phase 58 削除完了2025-11-29
//!
//! ## 削除内容
//!
//! - **ConservativeMerge struct**: 削除約60行
//! - **analyze メソッド**: `phi_merge.rs::merge_all_vars` にインライン化
//! - **テストコード**: 削除約35行
//!
//! ## 移行先
//!
//! `src/mir/builder/phi_merge.rs` の `PhiMergeHelper::merge_all_vars` メソッド内に
//! すべてのロジックがインライン化されている。
//!
//! ## 理論コメント保持理由
//!
//! Conservative ∘ Elimination = Minimal SSA の理論は重要なため、
//! このファイルはドキュメントとして残す。
//!
//! ## 旧コード履歴
//!
//! - Phase 25.1q: Conservative PHI戦略の一元化
//! - Phase 41-1: get_conservative_values 削除
//! - Phase 42: trace_if_enabled 削除
//! - Phase 47: compute_modified_names インライン化
//! - Phase 58: ConservativeMerge struct 完全削除
//!
//! ## 参照
//!
//! - Phase 37分析: `docs/.../phase-37-if-phi-reduction/conservative_responsibility_table.md`
//! - Phase 39設計: `docs/.../phase-39-if-phi-level2/joinir_extension_design.md`
// ========================================
// Phase 58削除済み2025-11-29
// ========================================
//
// 以下のコードは phi_merge.rs にインライン化済み:
//
// pub struct ConservativeMerge {
// pub all_vars: HashSet<String>,
// pub changed_vars: HashSet<String>,
// }
//
// impl ConservativeMerge {
// pub fn analyze(...) -> Self { ... }
// }
//
// テストも削除:
// - test_conservative_merge_both_defined
// - test_conservative_merge_union