This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
compiler/rustc_mir_transform/src Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ use rustc_span::DUMMY_SP;
15
15
16
16
use crate :: MirPass ;
17
17
18
- const TRACKING_LIMIT : usize = 1000 ;
18
+ const BLOCK_LIMIT : usize = 100 ;
19
+ const PLACE_LIMIT : usize = 100 ;
19
20
20
21
pub struct DataflowConstProp ;
21
22
@@ -26,6 +27,11 @@ 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 > ) {
30
+ if body. basic_blocks . len ( ) > BLOCK_LIMIT {
31
+ debug ! ( "aborted dataflow const prop due too many basic blocks" ) ;
32
+ return ;
33
+ }
34
+
29
35
// Decide which places to track during the analysis.
30
36
let map = Map :: from_filter ( tcx, body, Ty :: is_scalar) ;
31
37
@@ -37,7 +43,7 @@ impl<'tcx> MirPass<'tcx> for DataflowConstProp {
37
43
// `O(num_nodes * tracked_places * n)` in terms of time complexity. Since the number of
38
44
// map nodes is strongly correlated to the number of tracked places, this becomes more or
39
45
// less `O(n)` if we place a constant limit on the number of tracked places.
40
- if map. tracked_places ( ) > TRACKING_LIMIT {
46
+ if map. tracked_places ( ) > PLACE_LIMIT {
41
47
debug ! ( "aborted dataflow const prop due to too many tracked places" ) ;
42
48
return ;
43
49
}
You can’t perform that action at this time.
0 commit comments