Skip to content

Commit 7ded340

Browse files
committed
Specify that method only applies statement effects.
1 parent aa697f5 commit 7ded340

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

compiler/rustc_mir_dataflow/src/framework/direction.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub trait Direction {
3333
where
3434
A: Analysis<'tcx>;
3535

36-
fn gen_kill_effects_in_block<'tcx, A>(
36+
fn gen_kill_statement_effects_in_block<'tcx, A>(
3737
analysis: &mut A,
3838
trans: &mut GenKillSet<A::Idx>,
3939
block: BasicBlock,
@@ -93,7 +93,7 @@ impl Direction for Backward {
9393
edges
9494
}
9595

96-
fn gen_kill_effects_in_block<'tcx, A>(
96+
fn gen_kill_statement_effects_in_block<'tcx, A>(
9797
analysis: &mut A,
9898
trans: &mut GenKillSet<A::Idx>,
9999
block: BasicBlock,
@@ -350,7 +350,7 @@ impl Direction for Forward {
350350
analysis.apply_terminator_effect(state, terminator, location)
351351
}
352352

353-
fn gen_kill_effects_in_block<'tcx, A>(
353+
fn gen_kill_statement_effects_in_block<'tcx, A>(
354354
analysis: &mut A,
355355
trans: &mut GenKillSet<A::Idx>,
356356
block: BasicBlock,

compiler/rustc_mir_dataflow/src/framework/engine.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ where
144144
// gen/kill problems on cyclic CFGs. This is not ideal, but it doesn't seem to degrade
145145
// performance in practice. I've tried a few ways to avoid this, but they have downsides. See
146146
// the message for the commit that added this FIXME for more information.
147-
apply_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
147+
apply_statement_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
148148
}
149149

150150
impl<'a, 'tcx, A, D, T> Engine<'a, 'tcx, A>
@@ -170,7 +170,12 @@ where
170170

171171
for (block, block_data) in body.basic_blocks.iter_enumerated() {
172172
let trans = &mut trans_for_block[block];
173-
A::Direction::gen_kill_effects_in_block(&mut analysis, trans, block, block_data);
173+
A::Direction::gen_kill_statement_effects_in_block(
174+
&mut analysis,
175+
trans,
176+
block,
177+
block_data,
178+
);
174179
}
175180

176181
let apply_trans = Box::new(move |bb: BasicBlock, state: &mut A::Domain| {
@@ -199,7 +204,7 @@ where
199204
tcx: TyCtxt<'tcx>,
200205
body: &'a mir::Body<'tcx>,
201206
analysis: A,
202-
apply_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
207+
apply_statement_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
203208
) -> Self {
204209
let mut entry_sets =
205210
IndexVec::from_fn_n(|_| analysis.bottom_value(body), body.basic_blocks.len());
@@ -210,7 +215,7 @@ where
210215
bug!("`initialize_start_block` is not yet supported for backward dataflow analyses");
211216
}
212217

213-
Engine { analysis, tcx, body, pass_name: None, entry_sets, apply_trans_for_block }
218+
Engine { analysis, tcx, body, pass_name: None, entry_sets, apply_statement_trans_for_block }
214219
}
215220

216221
/// Adds an identifier to the graphviz output for this particular run of a dataflow analysis.
@@ -232,7 +237,7 @@ where
232237
body,
233238
mut entry_sets,
234239
tcx,
235-
apply_trans_for_block,
240+
apply_statement_trans_for_block,
236241
pass_name,
237242
..
238243
} = self;
@@ -269,7 +274,7 @@ where
269274
&mut state,
270275
bb,
271276
bb_data,
272-
apply_trans_for_block.as_deref(),
277+
apply_statement_trans_for_block.as_deref(),
273278
);
274279

275280
A::Direction::join_state_into_successors_of(

0 commit comments

Comments
 (0)