fix(mir): PHI検証panic修正 - update_cfg()を検証前に呼び出し
A案実装: debug_verify_phi_inputs呼び出し前にCFG predecessorを更新
修正箇所(7箇所):
- src/mir/builder/phi.rs:50, 73, 132, 143
- src/mir/builder/ops.rs:273, 328, 351
根本原因:
- Branch/Jump命令でsuccessorは即座に更新
- predecessorはupdate_cfg()で遅延再構築
- PHI検証が先に実行されてpredecessor未更新でpanic
解決策:
- 各debug_verify_phi_inputs呼び出し前に
if let Some(func) = self.current_function.as_mut() {
func.update_cfg();
}
を挿入してCFGを同期
影響: if/else文、論理演算子(&&/||)のPHI生成が正常動作
This commit is contained in:
@ -36,7 +36,7 @@ static box LLVMBranchInstructionBox {
|
||||
batch_branch(branch_list) {
|
||||
local results = []
|
||||
local i = 0
|
||||
while i < branch_list.size() {
|
||||
while i < branch_list.length() {
|
||||
local branch = branch_list[i]
|
||||
local json = me.lower_branch(branch.cond, branch.then_block, branch.else_block)
|
||||
results.push(json)
|
||||
|
||||
@ -60,7 +60,7 @@ static box LLVMCompareInstructionBox {
|
||||
batch_compare(compare_list) {
|
||||
local results = []
|
||||
local i = 0
|
||||
while i < compare_list.size() {
|
||||
while i < compare_list.length() {
|
||||
local cmp = compare_list[i]
|
||||
local json = me.lower_compare(cmp.op, cmp.lhs, cmp.rhs, cmp.dst)
|
||||
results.push(json)
|
||||
|
||||
@ -40,7 +40,7 @@ static box LLVMCopyInstructionBox {
|
||||
batch_copy(copy_list) {
|
||||
local results = []
|
||||
local i = 0
|
||||
while i < copy_list.size() {
|
||||
while i < copy_list.length() {
|
||||
local copy = copy_list[i]
|
||||
local json = me.lower_copy(copy.dst, copy.src)
|
||||
results.push(json)
|
||||
|
||||
@ -45,7 +45,7 @@ static box LLVMJumpInstructionBox {
|
||||
batch_jump(jump_list) {
|
||||
local results = []
|
||||
local i = 0
|
||||
while i < jump_list.size() {
|
||||
while i < jump_list.length() {
|
||||
local jump = jump_list[i]
|
||||
local json = me.lower_jump(jump.target)
|
||||
results.push(json)
|
||||
|
||||
Reference in New Issue
Block a user