Skip to content

Commit 760881b

Browse files
committed
Create bottom on-the-fly instead of cloning it.
1 parent 9c97abd commit 760881b

File tree

1 file changed

+4
-3
lines changed
  • compiler/rustc_mir_dataflow/src/framework

1 file changed

+4
-3
lines changed

compiler/rustc_mir_dataflow/src/framework/engine.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,12 @@ where
201201
analysis: A,
202202
apply_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
203203
) -> Self {
204-
let bottom_value = analysis.bottom_value(body);
205-
let mut entry_sets = IndexVec::from_elem(bottom_value.clone(), &body.basic_blocks);
204+
let mut entry_sets =
205+
IndexVec::from_fn_n(|_| analysis.bottom_value(body), body.basic_blocks.len());
206206
analysis.initialize_start_block(body, &mut entry_sets[mir::START_BLOCK]);
207207

208-
if A::Direction::IS_BACKWARD && entry_sets[mir::START_BLOCK] != bottom_value {
208+
if A::Direction::IS_BACKWARD && entry_sets[mir::START_BLOCK] != analysis.bottom_value(body)
209+
{
209210
bug!("`initialize_start_block` is not yet supported for backward dataflow analyses");
210211
}
211212

0 commit comments

Comments
 (0)