File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
compiler/rustc_mir_transform/src Expand file tree Collapse file tree 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;
1414use crate :: MirPass ;
1515
1616// 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).
1718const BLOCK_LIMIT : usize = 100 ;
1819const PLACE_LIMIT : usize = 100 ;
1920
@@ -26,7 +27,7 @@ impl<'tcx> MirPass<'tcx> for DataflowConstProp {
2627
2728 #[ instrument( skip_all level = "debug" ) ]
2829 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 {
3031 debug ! ( "aborted dataflow const prop due too many basic blocks" ) ;
3132 return ;
3233 }
@@ -42,7 +43,7 @@ impl<'tcx> MirPass<'tcx> for DataflowConstProp {
4243 // `O(num_nodes * tracked_places * n)` in terms of time complexity. Since the number of
4344 // map nodes is strongly correlated to the number of tracked places, this becomes more or
4445 // 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 {
4647 debug ! ( "aborted dataflow const prop due to too many tracked places" ) ;
4748 return ;
4849 }
You can’t perform that action at this time.
0 commit comments