(
&self,
domtree: &DominatorTree,
errors: &mut VerifierErrors,
)
| 1215 | } |
| 1216 | |
| 1217 | fn domtree_integrity( |
| 1218 | &self, |
| 1219 | domtree: &DominatorTree, |
| 1220 | errors: &mut VerifierErrors, |
| 1221 | ) -> VerifierStepResult { |
| 1222 | // We consider two `DominatorTree`s to be equal if they return the same immediate |
| 1223 | // dominator for each block. Therefore the current domtree is valid if it matches the freshly |
| 1224 | // computed one. |
| 1225 | for block in self.func.layout.blocks() { |
| 1226 | let expected = self.expected_domtree.idom(block); |
| 1227 | let got = domtree.idom(block); |
| 1228 | if got != expected { |
| 1229 | return errors.fatal(( |
| 1230 | block, |
| 1231 | format!("invalid domtree, expected idom({block}) = {expected:?}, got {got:?}"), |
| 1232 | )); |
| 1233 | } |
| 1234 | } |
| 1235 | // We also verify if the postorder defined by `DominatorTree` is sane |
| 1236 | if domtree.cfg_postorder().len() != self.expected_domtree.cfg_postorder().len() { |
| 1237 | return errors.fatal(( |
| 1238 | AnyEntity::Function, |
| 1239 | "incorrect number of Blocks in postorder traversal", |
| 1240 | )); |
| 1241 | } |
| 1242 | for (index, (&test_block, &true_block)) in domtree |
| 1243 | .cfg_postorder() |
| 1244 | .iter() |
| 1245 | .zip(self.expected_domtree.cfg_postorder().iter()) |
| 1246 | .enumerate() |
| 1247 | { |
| 1248 | if test_block != true_block { |
| 1249 | return errors.fatal(( |
| 1250 | test_block, |
| 1251 | format!( |
| 1252 | "invalid domtree, postorder block number {index} should be {true_block}, got {test_block}" |
| 1253 | ), |
| 1254 | )); |
| 1255 | } |
| 1256 | } |
| 1257 | Ok(()) |
| 1258 | } |
| 1259 | |
| 1260 | fn typecheck_entry_block_params(&self, errors: &mut VerifierErrors) -> VerifierStepResult { |
| 1261 | if let Some(block) = self.func.layout.entry_block() { |
no test coverage detected