Add a verifier that SemIR is in SSA form. (#7771)

Check that every use of a non-constant instruction is dominated by a
definition of that instruction. Remove the fake (instruction creation
order based) dominance checks in convert; these start spuriously failing
during template instantiation of initializers.

Assisted-by: Claude Opus 5 via Antigravity
This commit is contained in:
Richard Smith
2026-09-29 20:49:37 +00:00
committed by GitHub
parent 5dae7b40b9
commit c2d9cde674
16 changed files with 2006 additions and 104 deletions
-8
View File
@@ -2543,14 +2543,6 @@ auto InitializeExisting(Context& context, SemIR::LocId loc_id,
storage_id = SemIR::InstId::None;
}
// TODO: This is only an approximation of a dominance check. Add a general
// end-of-phase dominance check and remove the check here and the one in
// `MergeReplacing`.
CARBON_CHECK(!storage_id.has_value() ||
value_id == SemIR::ErrorInst::InstId ||
context.insts().GetRawIndex(storage_id) <=
context.insts().GetRawIndex(value_id),
"Storage might not dominate initializer");
PendingBlock target_block(&context);
return Convert(context, loc_id, value_id,
{.kind = ConversionTarget::Initializing,