Skip to content

Commit 3f06a33

Browse files
committed
Merge branch 'enable-dcp'
2 parents a4834ce + f7ed0ba commit 3f06a33

File tree

3 files changed

+90
-254
lines changed

3 files changed

+90
-254
lines changed

compiler/rustc_mir_transform/src/dataflow_const_prop.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,18 @@ use crate::const_prop::throw_machine_stop_str;
2525

2626
// These constants are somewhat random guesses and have not been optimized.
2727
// If `tcx.sess.mir_opt_level() >= 4`, we ignore the limits (this can become very expensive).
28-
const BLOCK_LIMIT: usize = 100;
2928
const PLACE_LIMIT: usize = 100;
3029

3130
pub struct DataflowConstProp;
3231

3332
impl<'tcx> MirPass<'tcx> for DataflowConstProp {
3433
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
35-
sess.mir_opt_level() >= 3
34+
sess.mir_opt_level() >= 2
3635
}
3736

3837
#[instrument(skip_all level = "debug")]
3938
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
4039
debug!(def_id = ?body.source.def_id());
41-
if tcx.sess.mir_opt_level() < 4 && body.basic_blocks.len() > BLOCK_LIMIT {
42-
debug!("aborted dataflow const prop due too many basic blocks");
43-
return;
44-
}
4540

4641
// We want to have a somewhat linear runtime w.r.t. the number of statements/terminators.
4742
// Let's call this number `n`. Dataflow analysis has `O(h*n)` transfer function

0 commit comments

Comments
 (0)