Normalize passes keep spans and clean warnings

This commit is contained in:
nyash-codex
2025-11-24 15:02:51 +09:00
parent 466e636af6
commit da1a5558e5
40 changed files with 547 additions and 362 deletions

View File

@ -17,8 +17,8 @@ pub fn compute_def_blocks(function: &MirFunction) -> HashMap<ValueId, BasicBlock
def_block.insert(*pid, function.entry_block);
}
for (bid, block) in &function.blocks {
for inst in block.all_instructions() {
if let Some(dst) = inst.dst_value() {
for sp in block.all_spanned_instructions() {
if let Some(dst) = sp.inst.dst_value() {
def_block.insert(dst, *bid);
}
}
@ -79,8 +79,8 @@ pub fn compute_reachable_blocks(function: &MirFunction) -> HashSet<BasicBlockId>
worklist.push(*successor);
}
}
for instruction in &block.instructions {
if let crate::mir::MirInstruction::Catch { handler_bb, .. } = instruction {
for sp in block.iter_spanned() {
if let crate::mir::MirInstruction::Catch { handler_bb, .. } = sp.inst {
if !reachable.contains(handler_bb) {
worklist.push(*handler_bb);
}