Skip to content

Commit 76f5bc6

Browse files
committed
Create mapped places upon seeing them in the body.
1 parent 44fb857 commit 76f5bc6

12 files changed

+271
-272
lines changed

compiler/rustc_mir_dataflow/src/value_analysis.rs

+117-122
Large diffs are not rendered by default.

compiler/rustc_mir_transform/src/dataflow_const_prop.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'tcx> MirPass<'tcx> for DataflowConstProp {
6666
}
6767

6868
struct ConstAnalysis<'a, 'tcx> {
69-
map: Map,
69+
map: Map<'tcx>,
7070
tcx: TyCtxt<'tcx>,
7171
local_decls: &'a LocalDecls<'tcx>,
7272
ecx: InterpCx<'tcx, DummyMachine>,
@@ -78,7 +78,7 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> {
7878

7979
const NAME: &'static str = "ConstAnalysis";
8080

81-
fn map(&self) -> &Map {
81+
fn map(&self) -> &Map<'tcx> {
8282
&self.map
8383
}
8484

@@ -330,7 +330,7 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> {
330330
}
331331

332332
impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
333-
pub fn new(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, map: Map) -> Self {
333+
pub fn new(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, map: Map<'tcx>) -> Self {
334334
let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id());
335335
Self {
336336
map,
@@ -560,12 +560,13 @@ impl<'tcx, 'locals> Collector<'tcx, 'locals> {
560560
Self { patch: Patch::new(tcx), local_decls }
561561
}
562562

563+
#[instrument(level = "trace", skip(self, ecx, map), ret)]
563564
fn try_make_constant(
564565
&self,
565566
ecx: &mut InterpCx<'tcx, DummyMachine>,
566567
place: Place<'tcx>,
567568
state: &State<FlatSet<Scalar>>,
568-
map: &Map,
569+
map: &Map<'tcx>,
569570
) -> Option<Const<'tcx>> {
570571
let ty = place.ty(self.local_decls, self.patch.tcx).ty;
571572
let layout = ecx.layout_of(ty).ok()?;
@@ -598,10 +599,11 @@ impl<'tcx, 'locals> Collector<'tcx, 'locals> {
598599
}
599600
}
600601

602+
#[instrument(level = "trace", skip(map), ret)]
601603
fn propagatable_scalar(
602604
place: PlaceIndex,
603605
state: &State<FlatSet<Scalar>>,
604-
map: &Map,
606+
map: &Map<'_>,
605607
) -> Option<Scalar> {
606608
if let FlatSet::Elem(value) = state.get_idx(place, map)
607609
&& value.try_to_scalar_int().is_ok()
@@ -613,14 +615,14 @@ fn propagatable_scalar(
613615
}
614616
}
615617

616-
#[instrument(level = "trace", skip(ecx, state, map))]
618+
#[instrument(level = "trace", skip(ecx, state, map), ret)]
617619
fn try_write_constant<'tcx>(
618620
ecx: &mut InterpCx<'tcx, DummyMachine>,
619621
dest: &PlaceTy<'tcx>,
620622
place: PlaceIndex,
621623
ty: Ty<'tcx>,
622624
state: &State<FlatSet<Scalar>>,
623-
map: &Map,
625+
map: &Map<'tcx>,
624626
) -> InterpResult<'tcx> {
625627
let layout = ecx.layout_of(ty)?;
626628

@@ -719,6 +721,7 @@ impl<'mir, 'tcx>
719721
{
720722
type FlowState = State<FlatSet<Scalar>>;
721723

724+
#[instrument(level = "trace", skip(self, results, statement))]
722725
fn visit_statement_before_primary_effect(
723726
&mut self,
724727
results: &mut Results<'tcx, ValueAnalysisWrapper<ConstAnalysis<'_, 'tcx>>>,
@@ -740,6 +743,7 @@ impl<'mir, 'tcx>
740743
}
741744
}
742745

746+
#[instrument(level = "trace", skip(self, results, statement))]
743747
fn visit_statement_after_primary_effect(
744748
&mut self,
745749
results: &mut Results<'tcx, ValueAnalysisWrapper<ConstAnalysis<'_, 'tcx>>>,
@@ -834,7 +838,7 @@ struct OperandCollector<'tcx, 'map, 'locals, 'a> {
834838
state: &'a State<FlatSet<Scalar>>,
835839
visitor: &'a mut Collector<'tcx, 'locals>,
836840
ecx: &'map mut InterpCx<'tcx, DummyMachine>,
837-
map: &'map Map,
841+
map: &'map Map<'tcx>,
838842
}
839843

840844
impl<'tcx> Visitor<'tcx> for OperandCollector<'tcx, '_, '_, '_> {

compiler/rustc_mir_transform/src/jump_threading.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ struct TOFinder<'tcx, 'a> {
123123
param_env: ty::ParamEnv<'tcx>,
124124
ecx: InterpCx<'tcx, DummyMachine>,
125125
body: &'a Body<'tcx>,
126-
map: &'a Map,
126+
map: &'a Map<'tcx>,
127127
loop_headers: &'a BitSet<BasicBlock>,
128128
/// We use an arena to avoid cloning the slices when cloning `state`.
129129
arena: &'a DroplessArena,

tests/coverage/try_error_result.cov-map

+114-85
Original file line numberDiff line numberDiff line change
@@ -81,101 +81,130 @@ Number of file 0 mappings: 11
8181
= (((c4 + Zero) + Zero) + c3)
8282

8383
Function name: try_error_result::test2
84-
Raw bytes (280): 0x[01, 01, 24, 01, 07, 00, 09, 03, 0d, 41, 00, 1e, 00, 41, 00, 1e, 00, 41, 00, 4a, 00, 4e, 00, 52, 41, 03, 0d, 52, 41, 03, 0d, 4e, 00, 52, 41, 03, 0d, 4a, 00, 4e, 00, 52, 41, 03, 0d, 66, 00, 45, 00, 45, 00, 66, 00, 45, 00, 7a, 00, 4d, 00, 4d, 00, 7a, 00, 4d, 00, 83, 01, 0d, 87, 01, 00, 00, 8b, 01, 8f, 01, 00, 19, 00, 28, 01, 3d, 01, 03, 17, 03, 08, 09, 00, 0e, 52, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 00, 00, 2f, 00, 30, 1e, 00, 31, 03, 35, 00, 04, 11, 00, 12, 1a, 02, 11, 04, 12, 00, 05, 11, 00, 14, 1a, 00, 17, 00, 41, 19, 00, 41, 00, 42, 00, 00, 43, 00, 5f, 00, 00, 5f, 00, 60, 00, 01, 0d, 00, 20, 00, 01, 11, 00, 14, 00, 00, 17, 00, 41, 00, 00, 41, 00, 42, 00, 00, 43, 00, 60, 00, 00, 60, 00, 61, 00, 01, 0d, 00, 20, 46, 04, 11, 00, 14, 4e, 00, 17, 00, 42, 00, 00, 42, 00, 43, 4a, 00, 44, 00, 61, 00, 00, 61, 00, 62, 46, 01, 0d, 00, 20, 62, 01, 11, 00, 14, 45, 00, 17, 01, 36, 00, 01, 36, 00, 37, 66, 01, 12, 00, 2f, 00, 00, 2f, 00, 30, 62, 01, 0d, 00, 20, 76, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 00, 02, 11, 00, 12, 7a, 01, 12, 00, 2f, 00, 01, 11, 00, 12, 76, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, 7f, 01, 01, 00, 02]
84+
Raw bytes (358): 0x[01, 01, 3b, 01, 07, 05, 09, 03, 0d, 41, 11, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 4a, 15, 41, 11, 46, 19, 4a, 15, 41, 11, 42, 1d, 46, 19, 4a, 15, 41, 11, 5e, 25, 49, 21, 49, 21, 5e, 25, 49, 21, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, 92, 01, 41, 03, 0d, 8e, 01, 29, 92, 01, 41, 03, 0d, 8a, 01, 2d, 8e, 01, 29, 92, 01, 41, 03, 0d, a6, 01, 35, 45, 31, 45, 31, a6, 01, 35, 45, 31, ba, 01, 3d, 4d, 39, 4d, 39, ba, 01, 3d, 4d, 39, c3, 01, 0d, c7, 01, db, 01, cb, 01, cf, 01, 11, 15, d3, 01, d7, 01, 19, 1d, 21, 25, df, 01, e3, 01, 29, 2d, e7, 01, eb, 01, 31, 35, 39, 3d, 28, 01, 3d, 01, 03, 17, 03, 08, 09, 00, 0e, 92, 01, 02, 09, 04, 1a, 41, 06, 0d, 00, 2f, 11, 00, 2f, 00, 30, 4a, 00, 31, 03, 35, 15, 04, 11, 00, 12, 46, 02, 11, 04, 12, 3e, 05, 11, 00, 14, 46, 00, 17, 00, 41, 19, 00, 41, 00, 42, 42, 00, 43, 00, 5f, 1d, 00, 5f, 00, 60, 3e, 01, 0d, 00, 20, 5a, 01, 11, 00, 14, 49, 00, 17, 00, 41, 21, 00, 41, 00, 42, 5e, 00, 43, 00, 60, 25, 00, 60, 00, 61, 5a, 01, 0d, 00, 20, 86, 01, 04, 11, 00, 14, 8e, 01, 00, 17, 00, 42, 29, 00, 42, 00, 43, 8a, 01, 00, 44, 00, 61, 2d, 00, 61, 00, 62, 86, 01, 01, 0d, 00, 20, a2, 01, 01, 11, 00, 14, 45, 00, 17, 01, 36, 31, 01, 36, 00, 37, a6, 01, 01, 12, 00, 2f, 35, 00, 2f, 00, 30, a2, 01, 01, 0d, 00, 20, b6, 01, 01, 11, 00, 14, 4d, 00, 17, 01, 36, 39, 02, 11, 00, 12, ba, 01, 01, 12, 00, 2f, 3d, 01, 11, 00, 12, b6, 01, 02, 0d, 00, 20, 0d, 03, 05, 00, 0b, bf, 01, 01, 01, 00, 02]
8585
Number of files: 1
8686
- file 0 => global file 1
87-
Number of expressions: 36
87+
Number of expressions: 59
8888
- expression 0 operands: lhs = Counter(0), rhs = Expression(1, Add)
89-
- expression 1 operands: lhs = Zero, rhs = Counter(2)
89+
- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
9090
- expression 2 operands: lhs = Expression(0, Add), rhs = Counter(3)
91-
- expression 3 operands: lhs = Counter(16), rhs = Zero
92-
- expression 4 operands: lhs = Expression(7, Sub), rhs = Zero
93-
- expression 5 operands: lhs = Counter(16), rhs = Zero
94-
- expression 6 operands: lhs = Expression(7, Sub), rhs = Zero
95-
- expression 7 operands: lhs = Counter(16), rhs = Zero
96-
- expression 8 operands: lhs = Expression(18, Sub), rhs = Zero
97-
- expression 9 operands: lhs = Expression(19, Sub), rhs = Zero
98-
- expression 10 operands: lhs = Expression(20, Sub), rhs = Counter(16)
99-
- expression 11 operands: lhs = Expression(0, Add), rhs = Counter(3)
100-
- expression 12 operands: lhs = Expression(20, Sub), rhs = Counter(16)
101-
- expression 13 operands: lhs = Expression(0, Add), rhs = Counter(3)
102-
- expression 14 operands: lhs = Expression(19, Sub), rhs = Zero
103-
- expression 15 operands: lhs = Expression(20, Sub), rhs = Counter(16)
104-
- expression 16 operands: lhs = Expression(0, Add), rhs = Counter(3)
105-
- expression 17 operands: lhs = Expression(18, Sub), rhs = Zero
106-
- expression 18 operands: lhs = Expression(19, Sub), rhs = Zero
107-
- expression 19 operands: lhs = Expression(20, Sub), rhs = Counter(16)
108-
- expression 20 operands: lhs = Expression(0, Add), rhs = Counter(3)
109-
- expression 21 operands: lhs = Expression(25, Sub), rhs = Zero
110-
- expression 22 operands: lhs = Counter(17), rhs = Zero
111-
- expression 23 operands: lhs = Counter(17), rhs = Zero
112-
- expression 24 operands: lhs = Expression(25, Sub), rhs = Zero
113-
- expression 25 operands: lhs = Counter(17), rhs = Zero
114-
- expression 26 operands: lhs = Expression(30, Sub), rhs = Zero
115-
- expression 27 operands: lhs = Counter(19), rhs = Zero
116-
- expression 28 operands: lhs = Counter(19), rhs = Zero
117-
- expression 29 operands: lhs = Expression(30, Sub), rhs = Zero
118-
- expression 30 operands: lhs = Counter(19), rhs = Zero
119-
- expression 31 operands: lhs = Expression(32, Add), rhs = Counter(3)
120-
- expression 32 operands: lhs = Expression(33, Add), rhs = Zero
121-
- expression 33 operands: lhs = Zero, rhs = Expression(34, Add)
122-
- expression 34 operands: lhs = Expression(35, Add), rhs = Zero
123-
- expression 35 operands: lhs = Counter(6), rhs = Zero
91+
- expression 3 operands: lhs = Counter(16), rhs = Counter(4)
92+
- expression 4 operands: lhs = Expression(18, Sub), rhs = Counter(5)
93+
- expression 5 operands: lhs = Counter(16), rhs = Counter(4)
94+
- expression 6 operands: lhs = Expression(16, Sub), rhs = Counter(7)
95+
- expression 7 operands: lhs = Expression(17, Sub), rhs = Counter(6)
96+
- expression 8 operands: lhs = Expression(18, Sub), rhs = Counter(5)
97+
- expression 9 operands: lhs = Counter(16), rhs = Counter(4)
98+
- expression 10 operands: lhs = Expression(18, Sub), rhs = Counter(5)
99+
- expression 11 operands: lhs = Counter(16), rhs = Counter(4)
100+
- expression 12 operands: lhs = Expression(17, Sub), rhs = Counter(6)
101+
- expression 13 operands: lhs = Expression(18, Sub), rhs = Counter(5)
102+
- expression 14 operands: lhs = Counter(16), rhs = Counter(4)
103+
- expression 15 operands: lhs = Expression(16, Sub), rhs = Counter(7)
104+
- expression 16 operands: lhs = Expression(17, Sub), rhs = Counter(6)
105+
- expression 17 operands: lhs = Expression(18, Sub), rhs = Counter(5)
106+
- expression 18 operands: lhs = Counter(16), rhs = Counter(4)
107+
- expression 19 operands: lhs = Expression(23, Sub), rhs = Counter(9)
108+
- expression 20 operands: lhs = Counter(18), rhs = Counter(8)
109+
- expression 21 operands: lhs = Counter(18), rhs = Counter(8)
110+
- expression 22 operands: lhs = Expression(23, Sub), rhs = Counter(9)
111+
- expression 23 operands: lhs = Counter(18), rhs = Counter(8)
112+
- expression 24 operands: lhs = Expression(34, Sub), rhs = Counter(11)
113+
- expression 25 operands: lhs = Expression(35, Sub), rhs = Counter(10)
114+
- expression 26 operands: lhs = Expression(36, Sub), rhs = Counter(16)
115+
- expression 27 operands: lhs = Expression(0, Add), rhs = Counter(3)
116+
- expression 28 operands: lhs = Expression(36, Sub), rhs = Counter(16)
117+
- expression 29 operands: lhs = Expression(0, Add), rhs = Counter(3)
118+
- expression 30 operands: lhs = Expression(35, Sub), rhs = Counter(10)
119+
- expression 31 operands: lhs = Expression(36, Sub), rhs = Counter(16)
120+
- expression 32 operands: lhs = Expression(0, Add), rhs = Counter(3)
121+
- expression 33 operands: lhs = Expression(34, Sub), rhs = Counter(11)
122+
- expression 34 operands: lhs = Expression(35, Sub), rhs = Counter(10)
123+
- expression 35 operands: lhs = Expression(36, Sub), rhs = Counter(16)
124+
- expression 36 operands: lhs = Expression(0, Add), rhs = Counter(3)
125+
- expression 37 operands: lhs = Expression(41, Sub), rhs = Counter(13)
126+
- expression 38 operands: lhs = Counter(17), rhs = Counter(12)
127+
- expression 39 operands: lhs = Counter(17), rhs = Counter(12)
128+
- expression 40 operands: lhs = Expression(41, Sub), rhs = Counter(13)
129+
- expression 41 operands: lhs = Counter(17), rhs = Counter(12)
130+
- expression 42 operands: lhs = Expression(46, Sub), rhs = Counter(15)
131+
- expression 43 operands: lhs = Counter(19), rhs = Counter(14)
132+
- expression 44 operands: lhs = Counter(19), rhs = Counter(14)
133+
- expression 45 operands: lhs = Expression(46, Sub), rhs = Counter(15)
134+
- expression 46 operands: lhs = Counter(19), rhs = Counter(14)
135+
- expression 47 operands: lhs = Expression(48, Add), rhs = Counter(3)
136+
- expression 48 operands: lhs = Expression(49, Add), rhs = Expression(54, Add)
137+
- expression 49 operands: lhs = Expression(50, Add), rhs = Expression(51, Add)
138+
- expression 50 operands: lhs = Counter(4), rhs = Counter(5)
139+
- expression 51 operands: lhs = Expression(52, Add), rhs = Expression(53, Add)
140+
- expression 52 operands: lhs = Counter(6), rhs = Counter(7)
141+
- expression 53 operands: lhs = Counter(8), rhs = Counter(9)
142+
- expression 54 operands: lhs = Expression(55, Add), rhs = Expression(56, Add)
143+
- expression 55 operands: lhs = Counter(10), rhs = Counter(11)
144+
- expression 56 operands: lhs = Expression(57, Add), rhs = Expression(58, Add)
145+
- expression 57 operands: lhs = Counter(12), rhs = Counter(13)
146+
- expression 58 operands: lhs = Counter(14), rhs = Counter(15)
124147
Number of file 0 mappings: 40
125148
- Code(Counter(0)) at (prev + 61, 1) to (start + 3, 23)
126149
- Code(Expression(0, Add)) at (prev + 8, 9) to (start + 0, 14)
127-
= (c0 + (Zero + c2))
128-
- Code(Expression(20, Sub)) at (prev + 2, 9) to (start + 4, 26)
129-
= ((c0 + (Zero + c2)) - c3)
150+
= (c0 + (c1 + c2))
151+
- Code(Expression(36, Sub)) at (prev + 2, 9) to (start + 4, 26)
152+
= ((c0 + (c1 + c2)) - c3)
130153
- Code(Counter(16)) at (prev + 6, 13) to (start + 0, 47)
131-
- Code(Zero) at (prev + 0, 47) to (start + 0, 48)
132-
- Code(Expression(7, Sub)) at (prev + 0, 49) to (start + 3, 53)
133-
= (c16 - Zero)
134-
- Code(Zero) at (prev + 4, 17) to (start + 0, 18)
135-
- Code(Expression(6, Sub)) at (prev + 2, 17) to (start + 4, 18)
136-
= ((c16 - Zero) - Zero)
137-
- Code(Zero) at (prev + 5, 17) to (start + 0, 20)
138-
- Code(Expression(6, Sub)) at (prev + 0, 23) to (start + 0, 65)
139-
= ((c16 - Zero) - Zero)
154+
- Code(Counter(4)) at (prev + 0, 47) to (start + 0, 48)
155+
- Code(Expression(18, Sub)) at (prev + 0, 49) to (start + 3, 53)
156+
= (c16 - c4)
157+
- Code(Counter(5)) at (prev + 4, 17) to (start + 0, 18)
158+
- Code(Expression(17, Sub)) at (prev + 2, 17) to (start + 4, 18)
159+
= ((c16 - c4) - c5)
160+
- Code(Expression(15, Sub)) at (prev + 5, 17) to (start + 0, 20)
161+
= ((((c16 - c4) - c5) - c6) - c7)
162+
- Code(Expression(17, Sub)) at (prev + 0, 23) to (start + 0, 65)
163+
= ((c16 - c4) - c5)
140164
- Code(Counter(6)) at (prev + 0, 65) to (start + 0, 66)
141-
- Code(Zero) at (prev + 0, 67) to (start + 0, 95)
142-
- Code(Zero) at (prev + 0, 95) to (start + 0, 96)
143-
- Code(Zero) at (prev + 1, 13) to (start + 0, 32)
144-
- Code(Zero) at (prev + 1, 17) to (start + 0, 20)
145-
- Code(Zero) at (prev + 0, 23) to (start + 0, 65)
146-
- Code(Zero) at (prev + 0, 65) to (start + 0, 66)
147-
- Code(Zero) at (prev + 0, 67) to (start + 0, 96)
148-
- Code(Zero) at (prev + 0, 96) to (start + 0, 97)
149-
- Code(Zero) at (prev + 1, 13) to (start + 0, 32)
150-
- Code(Expression(17, Sub)) at (prev + 4, 17) to (start + 0, 20)
151-
= (((((c0 + (Zero + c2)) - c3) - c16) - Zero) - Zero)
152-
- Code(Expression(19, Sub)) at (prev + 0, 23) to (start + 0, 66)
153-
= (((c0 + (Zero + c2)) - c3) - c16)
154-
- Code(Zero) at (prev + 0, 66) to (start + 0, 67)
155-
- Code(Expression(18, Sub)) at (prev + 0, 68) to (start + 0, 97)
156-
= ((((c0 + (Zero + c2)) - c3) - c16) - Zero)
157-
- Code(Zero) at (prev + 0, 97) to (start + 0, 98)
158-
- Code(Expression(17, Sub)) at (prev + 1, 13) to (start + 0, 32)
159-
= (((((c0 + (Zero + c2)) - c3) - c16) - Zero) - Zero)
160-
- Code(Expression(24, Sub)) at (prev + 1, 17) to (start + 0, 20)
161-
= ((c17 - Zero) - Zero)
165+
- Code(Expression(16, Sub)) at (prev + 0, 67) to (start + 0, 95)
166+
= (((c16 - c4) - c5) - c6)
167+
- Code(Counter(7)) at (prev + 0, 95) to (start + 0, 96)
168+
- Code(Expression(15, Sub)) at (prev + 1, 13) to (start + 0, 32)
169+
= ((((c16 - c4) - c5) - c6) - c7)
170+
- Code(Expression(22, Sub)) at (prev + 1, 17) to (start + 0, 20)
171+
= ((c18 - c8) - c9)
172+
- Code(Counter(18)) at (prev + 0, 23) to (start + 0, 65)
173+
- Code(Counter(8)) at (prev + 0, 65) to (start + 0, 66)
174+
- Code(Expression(23, Sub)) at (prev + 0, 67) to (start + 0, 96)
175+
= (c18 - c8)
176+
- Code(Counter(9)) at (prev + 0, 96) to (start + 0, 97)
177+
- Code(Expression(22, Sub)) at (prev + 1, 13) to (start + 0, 32)
178+
= ((c18 - c8) - c9)
179+
- Code(Expression(33, Sub)) at (prev + 4, 17) to (start + 0, 20)
180+
= (((((c0 + (c1 + c2)) - c3) - c16) - c10) - c11)
181+
- Code(Expression(35, Sub)) at (prev + 0, 23) to (start + 0, 66)
182+
= (((c0 + (c1 + c2)) - c3) - c16)
183+
- Code(Counter(10)) at (prev + 0, 66) to (start + 0, 67)
184+
- Code(Expression(34, Sub)) at (prev + 0, 68) to (start + 0, 97)
185+
= ((((c0 + (c1 + c2)) - c3) - c16) - c10)
186+
- Code(Counter(11)) at (prev + 0, 97) to (start + 0, 98)
187+
- Code(Expression(33, Sub)) at (prev + 1, 13) to (start + 0, 32)
188+
= (((((c0 + (c1 + c2)) - c3) - c16) - c10) - c11)
189+
- Code(Expression(40, Sub)) at (prev + 1, 17) to (start + 0, 20)
190+
= ((c17 - c12) - c13)
162191
- Code(Counter(17)) at (prev + 0, 23) to (start + 1, 54)
163-
- Code(Zero) at (prev + 1, 54) to (start + 0, 55)
164-
- Code(Expression(25, Sub)) at (prev + 1, 18) to (start + 0, 47)
165-
= (c17 - Zero)
166-
- Code(Zero) at (prev + 0, 47) to (start + 0, 48)
167-
- Code(Expression(24, Sub)) at (prev + 1, 13) to (start + 0, 32)
168-
= ((c17 - Zero) - Zero)
169-
- Code(Expression(29, Sub)) at (prev + 1, 17) to (start + 0, 20)
170-
= ((c19 - Zero) - Zero)
192+
- Code(Counter(12)) at (prev + 1, 54) to (start + 0, 55)
193+
- Code(Expression(41, Sub)) at (prev + 1, 18) to (start + 0, 47)
194+
= (c17 - c12)
195+
- Code(Counter(13)) at (prev + 0, 47) to (start + 0, 48)
196+
- Code(Expression(40, Sub)) at (prev + 1, 13) to (start + 0, 32)
197+
= ((c17 - c12) - c13)
198+
- Code(Expression(45, Sub)) at (prev + 1, 17) to (start + 0, 20)
199+
= ((c19 - c14) - c15)
171200
- Code(Counter(19)) at (prev + 0, 23) to (start + 1, 54)
172-
- Code(Zero) at (prev + 2, 17) to (start + 0, 18)
173-
- Code(Expression(30, Sub)) at (prev + 1, 18) to (start + 0, 47)
174-
= (c19 - Zero)
175-
- Code(Zero) at (prev + 1, 17) to (start + 0, 18)
176-
- Code(Expression(29, Sub)) at (prev + 2, 13) to (start + 0, 32)
177-
= ((c19 - Zero) - Zero)
201+
- Code(Counter(14)) at (prev + 2, 17) to (start + 0, 18)
202+
- Code(Expression(46, Sub)) at (prev + 1, 18) to (start + 0, 47)
203+
= (c19 - c14)
204+
- Code(Counter(15)) at (prev + 1, 17) to (start + 0, 18)
205+
- Code(Expression(45, Sub)) at (prev + 2, 13) to (start + 0, 32)
206+
= ((c19 - c14) - c15)
178207
- Code(Counter(3)) at (prev + 3, 5) to (start + 0, 11)
179-
- Code(Expression(31, Add)) at (prev + 1, 1) to (start + 0, 2)
180-
= (((Zero + ((c6 + Zero) + Zero)) + Zero) + c3)
208+
- Code(Expression(47, Add)) at (prev + 1, 1) to (start + 0, 2)
209+
= ((((c4 + c5) + ((c6 + c7) + (c8 + c9))) + ((c10 + c11) + ((c12 + c13) + (c14 + c15)))) + c3)
181210

tests/mir-opt/dataflow-const-prop/repr_transparent.main.DataflowConstProp.diff

+1-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
StorageDead(_5);
3333
StorageDead(_4);
3434
- _2 = I32(move _3);
35-
+ _2 = const I32(0_i32);
35+
+ _2 = I32(const 0_i32);
3636
StorageDead(_3);
3737
_0 = const ();
3838
StorageDead(_2);
@@ -42,10 +42,6 @@
4242
+ }
4343
+
4444
+ ALLOC0 (size: 4, align: 4) {
45-
+ 00 00 00 00 │ ....
46-
+ }
47-
+
48-
+ ALLOC1 (size: 4, align: 4) {
4945
+ 00 00 00 00 │ ....
5046
}
5147

tests/mir-opt/dataflow-const-prop/repr_transparent.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ fn main() {
1515
// CHECK: [[x]] = const I32(0_i32);
1616
let x = I32(0);
1717

18-
// CHECK: [[y]] = const I32(0_i32);
18+
// CHECK: [[y]] = I32(const 0_i32);
1919
let y = I32(x.0 + x.0);
2020
}

0 commit comments

Comments
 (0)