refactor(verify): Phase 260 P2 - Remove dual-source edge-args validation
- Delete legacy jump_args consistency checks (62 lines from cfg.rs) - Metadata no longer exists, so dual-source validation is obsolete - Rely on existing SSA validation for PHI correctness Simplifies verification now that jump_args metadata is deleted and terminator operands are the sole source of truth. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -26,69 +26,6 @@ pub fn check_control_flow(function: &MirFunction) -> Result<(), Vec<Verification
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 260 P0: Fail-fast if terminator edge-args and legacy jump_args diverge.
|
||||
if block.has_legacy_jump_args() && block.legacy_jump_args_layout().is_none() {
|
||||
errors.push(VerificationError::ControlFlowError {
|
||||
block: *block_id,
|
||||
reason: "Legacy jump_args layout missing".to_string(),
|
||||
});
|
||||
}
|
||||
if let Some(term) = &block.terminator {
|
||||
match term {
|
||||
MirInstruction::Jump {
|
||||
edge_args: Some(edge_args),
|
||||
..
|
||||
} => {
|
||||
if block.has_legacy_jump_args() {
|
||||
let Some(legacy_layout) = block.legacy_jump_args_layout() else {
|
||||
errors.push(VerificationError::ControlFlowError {
|
||||
block: *block_id,
|
||||
reason: "Legacy jump_args layout missing with edge-args present"
|
||||
.to_string(),
|
||||
});
|
||||
continue;
|
||||
};
|
||||
let legacy_values = block.legacy_jump_args_values().unwrap_or_default();
|
||||
if edge_args.values.as_slice() != legacy_values {
|
||||
errors.push(VerificationError::ControlFlowError {
|
||||
block: *block_id,
|
||||
reason: format!(
|
||||
"Edge-args values mismatch: edge_args={:?}, legacy={:?}",
|
||||
edge_args.values, legacy_values
|
||||
),
|
||||
});
|
||||
}
|
||||
if edge_args.layout != legacy_layout {
|
||||
errors.push(VerificationError::ControlFlowError {
|
||||
block: *block_id,
|
||||
reason: format!(
|
||||
"Edge-args layout mismatch: edge_args={:?}, legacy={:?}",
|
||||
edge_args.layout, legacy_layout
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
MirInstruction::Jump { edge_args: None, .. } => {
|
||||
if block.has_legacy_jump_args() {
|
||||
errors.push(VerificationError::ControlFlowError {
|
||||
block: *block_id,
|
||||
reason: "Legacy jump_args present but Jump edge-args missing".to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
MirInstruction::Branch { .. } => {
|
||||
if block.has_legacy_jump_args() {
|
||||
errors.push(VerificationError::ControlFlowError {
|
||||
block: *block_id,
|
||||
reason: "Legacy jump_args present on Branch terminator".to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Unreachable blocks are allowed in MIR.
|
||||
// They are created intentionally by break/continue/return statements via
|
||||
|
||||
Reference in New Issue
Block a user