From aa1267f630e01d19dcd9247ffb3a795aba0df461 Mon Sep 17 00:00:00 2001 From: Tomasz Miąsko Date: Sat, 21 Jan 2023 00:00:00 +0000 Subject: Preprocess dominator tree to answer queries in O(1) --- compiler/rustc_const_eval/src/transform/validate.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_const_eval/src/transform') diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index 3c350e25ba6..2d8cbea8bac 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -155,7 +155,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { if self.unwind_edge_count <= 1 { return; } - let doms = self.body.basic_blocks.dominators(); + let dom_tree = self.body.basic_blocks.dominator_tree(); let mut post_contract_node = FxHashMap::default(); // Reusing the allocation across invocations of the closure let mut dom_path = vec![]; @@ -164,7 +164,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { if let Some(root) = post_contract_node.get(&bb) { break *root; } - let parent = doms.immediate_dominator(bb).unwrap(); + let parent = dom_tree.immediate_dominator(bb).unwrap(); dom_path.push(bb); if !self.body.basic_blocks[parent].is_cleanup { break bb; -- cgit 1.4.1-3-g733a5