mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Create bottom on-the-fly instead of cloning it.
This commit is contained in:
parent
9c97abd54c
commit
760881b29d
@ -201,11 +201,12 @@ where
|
|||||||
analysis: A,
|
analysis: A,
|
||||||
apply_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
|
apply_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let bottom_value = analysis.bottom_value(body);
|
let mut entry_sets =
|
||||||
let mut entry_sets = IndexVec::from_elem(bottom_value.clone(), &body.basic_blocks);
|
IndexVec::from_fn_n(|_| analysis.bottom_value(body), body.basic_blocks.len());
|
||||||
analysis.initialize_start_block(body, &mut entry_sets[mir::START_BLOCK]);
|
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");
|
bug!("`initialize_start_block` is not yet supported for backward dataflow analyses");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user