diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-05-06 11:08:36 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-08-16 18:12:17 +0000 |
| commit | 760881b29debf6b224b522fdd4d4ae2495380d99 (patch) | |
| tree | 96de28c83115093df291ced9cbce716cd3e01010 /compiler/rustc_mir_dataflow/src | |
| parent | 9c97abd54cdcc76cfe2b92e2459f8017ed2db1fd (diff) | |
| download | rust-760881b29debf6b224b522fdd4d4ae2495380d99.tar.gz rust-760881b29debf6b224b522fdd4d4ae2495380d99.zip | |
Create bottom on-the-fly instead of cloning it.
Diffstat (limited to 'compiler/rustc_mir_dataflow/src')
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/framework/engine.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_mir_dataflow/src/framework/engine.rs b/compiler/rustc_mir_dataflow/src/framework/engine.rs index c755d7588c2..1333b7de3b0 100644 --- a/compiler/rustc_mir_dataflow/src/framework/engine.rs +++ b/compiler/rustc_mir_dataflow/src/framework/engine.rs @@ -201,11 +201,12 @@ where analysis: A, 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_fn_n(|_| analysis.bottom_value(body), body.basic_blocks.len()); analysis.initialize_start_block(body, &mut entry_sets[mir::START_BLOCK]); - if A::Direction::IS_BACKWARD && entry_sets[mir::START_BLOCK] != bottom_value { + if A::Direction::IS_BACKWARD && entry_sets[mir::START_BLOCK] != analysis.bottom_value(body) + { bug!("`initialize_start_block` is not yet supported for backward dataflow analyses"); } |
