File tree 1 file changed +3
-2
lines changed
compiler/rustc_mir_transform/src
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ use rustc_span::DUMMY_SP;
14
14
use crate :: MirPass ;
15
15
16
16
// These constants are somewhat random guesses and have not been optimized.
17
+ // If `tcx.sess.mir_opt_level() >= 4`, we ignore the limits (this can become very expensive).
17
18
const BLOCK_LIMIT : usize = 100 ;
18
19
const PLACE_LIMIT : usize = 100 ;
19
20
@@ -26,7 +27,7 @@ impl<'tcx> MirPass<'tcx> for DataflowConstProp {
26
27
27
28
#[ instrument( skip_all level = "debug" ) ]
28
29
fn run_pass ( & self , tcx : TyCtxt < ' tcx > , body : & mut Body < ' tcx > ) {
29
- if body. basic_blocks . len ( ) > BLOCK_LIMIT {
30
+ if tcx . sess . mir_opt_level ( ) < 4 && body. basic_blocks . len ( ) > BLOCK_LIMIT {
30
31
debug ! ( "aborted dataflow const prop due too many basic blocks" ) ;
31
32
return ;
32
33
}
@@ -42,7 +43,7 @@ impl<'tcx> MirPass<'tcx> for DataflowConstProp {
42
43
// `O(num_nodes * tracked_places * n)` in terms of time complexity. Since the number of
43
44
// map nodes is strongly correlated to the number of tracked places, this becomes more or
44
45
// less `O(n)` if we place a constant limit on the number of tracked places.
45
- if map. tracked_places ( ) > PLACE_LIMIT {
46
+ if tcx . sess . mir_opt_level ( ) < 4 && map. tracked_places ( ) > PLACE_LIMIT {
46
47
debug ! ( "aborted dataflow const prop due to too many tracked places" ) ;
47
48
return ;
48
49
}
You can’t perform that action at this time.
0 commit comments