fix(llvm): Phase 131-6 調査 - TAG-RUN 3バグ発見(1修正/1部分/1未修正)
Phase 131-6: Infinite Loop Bug 調査完了 発見したバグ(3件): 1. Bug #1: Copy-to-PHI 命令(SSA 違反)✅ 修正完了 - instruction_rewriter.rs: PHI destination への Copy をスキップ 2. Bug #2: Type Inference 混同(String vs Integer)⚠️ 部分修正 - binop.py: force_string ロジック削除 3. Bug #3: SSA Dominance Violation ❌ 未修正 - MIR builder が定義前に値を使用(根本問題) 変更ファイル: - src/mir/builder/control_flow/joinir/merge/instruction_rewriter.rs: - Lines 428-443: header PHI への Copy スキップ追加 - src/llvm_py/instructions/binop.py: - Lines 128-159: force_string 削除、Phase 131-6 コメント追加 - docs/development/current/main/phase131-3-llvm-lowering-inventory.md: - 3バグの詳細追記 テスト結果: - Case A/B2: ✅ 退行なし - Case B: ❌ infinite loop 継続(Bug #3 が原因) - Simple Add: ❌ 0 を出力(期待: 1) Next: Phase 131-6 続き - MIR SSA dominance 根治 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -417,12 +417,31 @@ pub(super) fn merge_and_rewrite(
|
||||
}
|
||||
} else {
|
||||
// Insert Copy instructions for parameter binding
|
||||
// Phase 131-6 FIX: Skip Copy when dst is a header PHI destination
|
||||
// The PHI node will receive the value as an incoming edge instead
|
||||
for (i, arg_val_remapped) in args.iter().enumerate() {
|
||||
if i < target_params.len() {
|
||||
let param_val_original = target_params[i];
|
||||
if let Some(param_val_remapped) =
|
||||
remapper.get_value(param_val_original)
|
||||
{
|
||||
// Phase 131-6: Check if this would overwrite a header PHI dst
|
||||
let is_header_phi_dst = loop_header_phi_info
|
||||
.carrier_phis
|
||||
.values()
|
||||
.any(|entry| entry.phi_dst == param_val_remapped);
|
||||
|
||||
if is_header_phi_dst {
|
||||
if debug {
|
||||
eprintln!(
|
||||
"[cf_loop/joinir] Phase 131-6: Skip param binding to PHI dst {:?} (PHI receives value via incoming edge)",
|
||||
param_val_remapped
|
||||
);
|
||||
}
|
||||
// Skip - PHI will receive this value as incoming edge
|
||||
continue;
|
||||
}
|
||||
|
||||
new_block.instructions.push(MirInstruction::Copy {
|
||||
dst: param_val_remapped,
|
||||
src: *arg_val_remapped,
|
||||
|
||||
Reference in New Issue
Block a user