Skip to content

Commit 9f8538a

Browse files
committed
Enable DataflowConstProp by default.
1 parent 284cb71 commit 9f8538a

File tree

5 files changed

+122
-291
lines changed

5 files changed

+122
-291
lines changed

compiler/rustc_mir_transform/src/dataflow_const_prop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub struct DataflowConstProp;
3030

3131
impl<'tcx> MirPass<'tcx> for DataflowConstProp {
3232
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
33-
sess.mir_opt_level() >= 3
33+
sess.mir_opt_level() >= 2
3434
}
3535

3636
#[instrument(skip_all level = "debug")]

tests/coverage/closure.cov-map

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,16 @@ Number of file 0 mappings: 24
3333
- Code(Expression(1, Add)) at (prev + 1, 5) to (start + 3, 2)
3434
= (c1 + (c0 - c1))
3535

36-
Function name: closure::main::{closure#0}
37-
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 27, 05, 02, 14, 05, 02, 15, 02, 0a, 02, 02, 0a, 00, 0b, 07, 01, 09, 01, 06]
36+
Function name: closure::main::{closure#0} (unused)
37+
Raw bytes (24): 0x[01, 01, 00, 04, 00, 27, 05, 02, 14, 00, 02, 15, 02, 0a, 00, 02, 0a, 00, 0b, 00, 01, 09, 01, 06]
3838
Number of files: 1
3939
- file 0 => global file 1
40-
Number of expressions: 2
41-
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
42-
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
40+
Number of expressions: 0
4341
Number of file 0 mappings: 4
44-
- Code(Counter(0)) at (prev + 39, 5) to (start + 2, 20)
45-
- Code(Counter(1)) at (prev + 2, 21) to (start + 2, 10)
46-
- Code(Expression(0, Sub)) at (prev + 2, 10) to (start + 0, 11)
47-
= (c0 - c1)
48-
- Code(Expression(1, Add)) at (prev + 1, 9) to (start + 1, 6)
49-
= (c1 + (c0 - c1))
42+
- Code(Zero) at (prev + 39, 5) to (start + 2, 20)
43+
- Code(Zero) at (prev + 2, 21) to (start + 2, 10)
44+
- Code(Zero) at (prev + 2, 10) to (start + 0, 11)
45+
- Code(Zero) at (prev + 1, 9) to (start + 1, 6)
5046

5147
Function name: closure::main::{closure#10} (unused)
5248
Raw bytes (10): 0x[01, 01, 00, 01, 00, 9a, 01, 07, 00, 21]
@@ -148,20 +144,16 @@ Number of file 0 mappings: 6
148144
- Code(Expression(0, Add)) at (prev + 2, 9) to (start + 0, 10)
149145
= (c1 + (c0 - c1))
150146

151-
Function name: closure::main::{closure#18}
152-
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 18, 0d, 02, 1c, 05, 02, 1d, 02, 12, 02, 02, 12, 00, 13, 07, 01, 11, 01, 0e]
147+
Function name: closure::main::{closure#18} (unused)
148+
Raw bytes (24): 0x[01, 01, 00, 04, 00, 18, 0d, 02, 1c, 00, 02, 1d, 02, 12, 00, 02, 12, 00, 13, 00, 01, 11, 01, 0e]
153149
Number of files: 1
154150
- file 0 => global file 1
155-
Number of expressions: 2
156-
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
157-
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
151+
Number of expressions: 0
158152
Number of file 0 mappings: 4
159-
- Code(Counter(0)) at (prev + 24, 13) to (start + 2, 28)
160-
- Code(Counter(1)) at (prev + 2, 29) to (start + 2, 18)
161-
- Code(Expression(0, Sub)) at (prev + 2, 18) to (start + 0, 19)
162-
= (c0 - c1)
163-
- Code(Expression(1, Add)) at (prev + 1, 17) to (start + 1, 14)
164-
= (c1 + (c0 - c1))
153+
- Code(Zero) at (prev + 24, 13) to (start + 2, 28)
154+
- Code(Zero) at (prev + 2, 29) to (start + 2, 18)
155+
- Code(Zero) at (prev + 2, 18) to (start + 0, 19)
156+
- Code(Zero) at (prev + 1, 17) to (start + 1, 14)
165157

166158
Function name: closure::main::{closure#19}
167159
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 42, 0d, 02, 1c, 05, 02, 1d, 02, 12, 02, 02, 12, 00, 13, 07, 01, 11, 01, 0e]

0 commit comments

Comments
 (0)