Various cleanups to Layout (#6042)

* Use inst_block instead of pp_block where possible

* Remove unused is_block_gap method

* Remove ProgramOrder trait

It only has a single implementation

* Rename Layout::cmp to pp_cmp to distinguish it from Ord::cmp

* Make pp_block non-generic

* Use rpo_cmp_block instead of rpo_cmp in the verifier

* Remove ProgramPoint

* Rename ExpandedProgramPoint to ProgramPoint

* Remove From<ValueDef> for ProgramPoint impl
This commit is contained in:
bjorn3
2023-03-17 19:46:34 +01:00
committed by GitHub
parent 411a3eff3e
commit a81c206870
7 changed files with 65 additions and 176 deletions

View File

@@ -884,7 +884,11 @@ impl<'a> Verifier<'a> {
self.verify_value(loc_inst, v, errors)?;
let dfg = &self.func.dfg;
let loc_block = self.func.layout.pp_block(loc_inst);
let loc_block = self
.func
.layout
.inst_block(loc_inst)
.expect("Instruction not in layout.");
let is_reachable = self.expected_domtree.is_reachable(loc_block);
// SSA form
@@ -1101,17 +1105,13 @@ impl<'a> Verifier<'a> {
));
}
}
// We verify rpo_cmp on pairs of adjacent blocks in the postorder
// We verify rpo_cmp_block on pairs of adjacent blocks in the postorder
for (&prev_block, &next_block) in domtree.cfg_postorder().iter().adjacent_pairs() {
if self
.expected_domtree
.rpo_cmp(prev_block, next_block, &self.func.layout)
!= Ordering::Greater
{
if self.expected_domtree.rpo_cmp_block(prev_block, next_block) != Ordering::Greater {
return errors.fatal((
next_block,
format!(
"invalid domtree, rpo_cmp does not says {} is greater than {}",
"invalid domtree, rpo_cmp_block does not says {} is greater than {}",
prev_block, next_block
),
));