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

@ -134,17 +134,14 @@ impl LoopBuilderApi for super::builder::MirBuilder {
inputs: Vec<(BasicBlockId, ValueId)>,
) -> Result<(), String> {
if let Some(ref mut f) = self.current_function {
if let Some(bb) = f.get_block_mut(block) {
let inst = MirInstruction::Phi { dst, inputs };
// Update effect mask and insert at the very start
bb.effects = bb.effects | inst.effects();
bb.instructions.insert(0, inst);
bb.instruction_spans
.insert(0, self.current_span);
Ok(())
} else {
Err(format!("Block {} not found", block.as_u32()))
}
crate::mir::ssot::cf_common::insert_phi_at_head_spanned(
f,
block,
dst,
inputs,
self.current_span,
);
Ok(())
} else {
Err("No current function".into())
}