diff --git a/crates/oxide_cfg/src/partition.rs b/crates/oxide_cfg/src/partition.rs index 7079857..b2c3be7 100644 --- a/crates/oxide_cfg/src/partition.rs +++ b/crates/oxide_cfg/src/partition.rs @@ -22,8 +22,13 @@ pub(super) fn partition_blocks(f: &IRFunction) -> Vec { None => debug_assert!(false, "unresolved label {l}"), } } - // 条件跳转的 fallthrough 后继是块头(否则 cond+then 融块、条件边丢失)。 - if matches!(inst.op, OpCode::JMP_IF_TRUE | OpCode::JMP_IF_FALSE | OpCode::JMP_IF_NULLISH) { + // 跳转的 fallthrough 后继是块头:条件跳转否则 cond+then 融块、条件边丢失; + // 无条件 JMP 同样必须切块头——JMP 不 fallthrough,但其后继位置需成块边界, + // 否则 JMP 与后续指令融块、块尾判定错、Jump 边丢失(DCE 可达性误删目标块)。 + if matches!( + inst.op, + OpCode::JMP | OpCode::JMP_IF_TRUE | OpCode::JMP_IF_FALSE | OpCode::JMP_IF_NULLISH + ) { heads[i + 1] = true; } }