diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-29 06:34:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-29 06:34:43 +0200 |
| commit | d182081de1ae2fe580c038abd526d85cedafa712 (patch) | |
| tree | 0393e811cb218b1ee3d8a2a408a25d05d3ac29c9 /compiler/rustc_mir_dataflow/src/framework/engine.rs | |
| parent | a96b44c9e2f952282cff1b833f39d10b8cda5f66 (diff) | |
| parent | b48870b451dd9d3f3f827aa54d9becdfdd811ba3 (diff) | |
| download | rust-d182081de1ae2fe580c038abd526d85cedafa712.tar.gz rust-d182081de1ae2fe580c038abd526d85cedafa712.zip | |
Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obk
Replace `Body::basic_blocks()` with field access Since the refactoring in #98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
Diffstat (limited to 'compiler/rustc_mir_dataflow/src/framework/engine.rs')
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/framework/engine.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_mir_dataflow/src/framework/engine.rs b/compiler/rustc_mir_dataflow/src/framework/engine.rs index 112204c7599..bc75645e7c9 100644 --- a/compiler/rustc_mir_dataflow/src/framework/engine.rs +++ b/compiler/rustc_mir_dataflow/src/framework/engine.rs @@ -111,9 +111,9 @@ where // Otherwise, compute and store the cumulative transfer function for each block. let identity = GenKillSet::identity(analysis.bottom_value(body).domain_size()); - let mut trans_for_block = IndexVec::from_elem(identity, body.basic_blocks()); + let mut trans_for_block = IndexVec::from_elem(identity, &body.basic_blocks); - for (block, block_data) in body.basic_blocks().iter_enumerated() { + for (block, block_data) in body.basic_blocks.iter_enumerated() { let trans = &mut trans_for_block[block]; A::Direction::gen_kill_effects_in_block(&analysis, trans, block, block_data); } @@ -147,7 +147,7 @@ where apply_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>, ) -> Self { let bottom_value = analysis.bottom_value(body); - let mut entry_sets = IndexVec::from_elem(bottom_value.clone(), body.basic_blocks()); + let mut entry_sets = IndexVec::from_elem(bottom_value.clone(), &body.basic_blocks); analysis.initialize_start_block(body, &mut entry_sets[mir::START_BLOCK]); if A::Direction::IS_BACKWARD && entry_sets[mir::START_BLOCK] != bottom_value { @@ -200,8 +200,7 @@ where .. } = self; - let mut dirty_queue: WorkQueue<BasicBlock> = - WorkQueue::with_none(body.basic_blocks().len()); + let mut dirty_queue: WorkQueue<BasicBlock> = WorkQueue::with_none(body.basic_blocks.len()); if A::Direction::IS_FORWARD { for (bb, _) in traversal::reverse_postorder(body) { |
