LoopBuilder: bind variable_map to Phi result on seal

- After inserting Phi at loop header, update variable_map so that
  subsequent uses (after the loop) refer to the Phi result instead of
  the latch/body value. This fixes dominance issues in verifier.
- Add tests: loop phi normalization and loop+nested-if phi; both pass.
This commit is contained in:
Moe Charm
2025-08-26 06:35:39 +09:00
parent ea672eaa2c
commit 378a2bc174
3 changed files with 184 additions and 1 deletions

View File

@ -162,6 +162,8 @@ impl<'a> LoopBuilder<'a> {
// 完成したPhi nodeを発行
self.emit_phi_at_block_start(block_id, phi.phi_id, phi.known_inputs)?;
// 重要: ループ外から参照される変数はPhi結果に束縛し直す
self.update_variable(phi.var_name.clone(), phi.phi_id);
}
}