refactor(phi): Phase 57 PHI code reduction
## Changes ### 57-2-alt: Remove redundant ConservativeMerge call - phi.rs called ConservativeMerge::analyze twice (once directly, once via merge_all_vars) - Now merge_all_vars returns changed_vars, eliminating redundancy ### 57-3: Delete PhiMergeOps trait (dead code, 17 lines) - PhiMergeOps trait was defined but never called - Only impl in loop_builder.rs was unused - PhiBuilderOps has replaced it ### 57-4: Add responsibility comments to infer_type_from_phi - Document that it's the "last resort" for type inference - Specify deletion conditions (JoinIR type annotations) ## Cumulative PHI reduction - Phase 38: 90 lines - Phase 40-4.1: 35 lines - Phase 41-1: 99 lines - Phase 47: 33 lines - Phase 57: 17 lines (PhiMergeOps) + optimization - Total: 365+ lines removed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -21,19 +21,16 @@ impl MirBuilder {
|
||||
skip_var: Option<&str>,
|
||||
) -> Result<(), String> {
|
||||
// 📦 Phase 25.1q: Use PhiMergeHelper for unified PHI insertion
|
||||
// 📦 Phase 57: ConservativeMerge 冗長呼び出し削除
|
||||
// - 以前: ここで ConservativeMerge::analyze を呼び、merge_all_vars 内でも呼んでいた(2回)
|
||||
// - 現在: merge_all_vars が changed_vars を返すので、1回で済む
|
||||
use std::collections::HashSet;
|
||||
|
||||
let conservative = crate::mir::phi_core::conservative::ConservativeMerge::analyze(
|
||||
pre_if_snapshot,
|
||||
then_map_end,
|
||||
else_map_end_opt,
|
||||
);
|
||||
let changed_set: HashSet<String> = conservative.changed_vars.iter().cloned().collect();
|
||||
|
||||
// Use PhiMergeHelper for unified variable merging
|
||||
let mut helper =
|
||||
super::phi_merge::PhiMergeHelper::new(self, then_exit_block_opt, else_exit_block_opt);
|
||||
helper.merge_all_vars(pre_if_snapshot, then_map_end, else_map_end_opt, skip_var)?;
|
||||
let changed_set: HashSet<String> =
|
||||
helper.merge_all_vars(pre_if_snapshot, then_map_end, else_map_end_opt, skip_var)?;
|
||||
|
||||
// Ensure pinned synthetic slots ("__pin$...") have a block-local definition at the merge,
|
||||
// even if their values did not change across branches. This avoids undefined uses when
|
||||
|
||||
Reference in New Issue
Block a user