|
1 | 1 | use std::cell::RefCell; |
2 | 2 | use std::collections::hash_map::Entry; |
3 | | -use std::sync::atomic::{AtomicUsize, Ordering}; |
| 3 | +use std::sync::atomic::Ordering; |
4 | 4 |
|
5 | 5 | use rustc_data_structures::fx::{FxHashMap, FxIndexSet}; |
6 | 6 | use rustc_middle::mir::{Body, MirDumper, MirPhase, RuntimePhase}; |
@@ -290,6 +290,7 @@ fn run_passes_inner<'tcx>( |
290 | 290 | && let Some(limit) = &tcx.sess.opts.unstable_opts.mir_opt_bisect_limit |
291 | 291 | { |
292 | 292 | if limited_by_opt_bisect( |
| 293 | + tcx, |
293 | 294 | tcx.def_path_debug_str(body.source.def_id()), |
294 | 295 | *limit, |
295 | 296 | *pass, |
@@ -380,13 +381,17 @@ fn is_optimization_stage( |
380 | 381 | && phase_change == Some(MirPhase::Runtime(RuntimePhase::Optimized)) |
381 | 382 | } |
382 | 383 |
|
383 | | -static MIR_OPT_BISECT_COUNT: AtomicUsize = AtomicUsize::new(0); |
384 | | - |
385 | | -fn limited_by_opt_bisect<'tcx, P>(def_path: String, limit: usize, pass: &P) -> bool |
| 384 | +fn limited_by_opt_bisect<'tcx, P>( |
| 385 | + tcx: TyCtxt<'tcx>, |
| 386 | + def_path: String, |
| 387 | + limit: usize, |
| 388 | + pass: &P, |
| 389 | +) -> bool |
386 | 390 | where |
387 | 391 | P: MirPass<'tcx> + ?Sized, |
388 | 392 | { |
389 | | - let current_opt_bisect_count = MIR_OPT_BISECT_COUNT.fetch_add(1, Ordering::Relaxed); |
| 393 | + let current_opt_bisect_count = |
| 394 | + tcx.sess.mir_opt_bisect_eval_count.fetch_add(1, Ordering::Relaxed); |
390 | 395 |
|
391 | 396 | let can_run = current_opt_bisect_count < limit; |
392 | 397 |
|
|
0 commit comments