Skip to content

Commit 4e901be

Browse files
simonvandelerikdesjardins
authored andcommitted
Extend SimplifyLocals to remove ZST writes
1 parent e7e1dc1 commit 4e901be

File tree

34 files changed

+40
-40
lines changed

34 files changed

+40
-40
lines changed

compiler/rustc_mir/src/transform/simplify.rs

+27-3
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ pub fn simplify_locals<'tcx>(body: &mut Body<'tcx>, tcx: TyCtxt<'tcx>) {
333333
// count. For example, if we removed `_2 = discriminant(_1)`, then we'll subtract one from
334334
// `use_counts[_1]`. That in turn might make `_1` unused, so we loop until we hit a
335335
// fixedpoint where there are no more unused locals.
336-
remove_unused_definitions(&mut used_locals, body);
336+
remove_unused_definitions(&mut used_locals, body, tcx);
337337

338338
// Finally, we'll actually do the work of shrinking `body.local_decls` and remapping the `Local`s.
339339
let map = make_local_map(&mut body.local_decls, &used_locals);
@@ -462,12 +462,22 @@ impl Visitor<'_> for UsedLocals {
462462
}
463463

464464
/// Removes unused definitions. Updates the used locals to reflect the changes made.
465-
fn remove_unused_definitions<'a, 'tcx>(used_locals: &'a mut UsedLocals, body: &mut Body<'tcx>) {
465+
fn remove_unused_definitions<'a, 'tcx>(
466+
used_locals: &'a mut UsedLocals,
467+
body: &mut Body<'tcx>,
468+
tcx: TyCtxt<'tcx>,
469+
) {
466470
// The use counts are updated as we remove the statements. A local might become unused
467471
// during the retain operation, leading to a temporary inconsistency (storage statements or
468472
// definitions referencing the local might remain). For correctness it is crucial that this
469473
// computation reaches a fixed point.
470474

475+
let def_id = body.source.def_id();
476+
let is_static = tcx.is_static(def_id);
477+
let param_env = tcx.param_env(def_id);
478+
479+
let local_decls = body.local_decls.clone();
480+
471481
let mut modified = true;
472482
while modified {
473483
modified = false;
@@ -479,7 +489,21 @@ fn remove_unused_definitions<'a, 'tcx>(used_locals: &'a mut UsedLocals, body: &m
479489
StatementKind::StorageLive(local) | StatementKind::StorageDead(local) => {
480490
used_locals.is_used(*local)
481491
}
482-
StatementKind::Assign(box (place, _)) => used_locals.is_used(place.local),
492+
StatementKind::Assign(box (place, _)) => {
493+
let used = used_locals.is_used(place.local);
494+
let mut is_zst = false;
495+
496+
// ZST locals can be removed
497+
if used && !is_static {
498+
let ty = local_decls[place.local].ty;
499+
let param_env_and = param_env.and(ty);
500+
if let Ok(layout) = tcx.layout_of(param_env_and) {
501+
is_zst = layout.is_zst();
502+
}
503+
}
504+
505+
used && !is_zst
506+
}
483507

484508
StatementKind::SetDiscriminant { ref place, .. } => {
485509
used_locals.is_used(place.local)

src/test/codegen/naked-functions.rs

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#[naked]
1010
pub fn naked_empty() {
1111
// CHECK-NEXT: {{.+}}:
12+
// CHECK-NEXT: %0 = alloca {}, align 1
1213
// CHECK-NEXT: ret void
1314
}
1415

@@ -18,6 +19,7 @@ pub fn naked_empty() {
1819
// CHECK-NEXT: define void @naked_with_args(i{{[0-9]+( %a)?}})
1920
pub fn naked_with_args(a: isize) {
2021
// CHECK-NEXT: {{.+}}:
22+
// CHECK-NEXT: %0 = alloca {}, align 1
2123
// CHECK: ret void
2224
}
2325

src/test/mir-opt/const_prop/control_flow_simplification.hello.PreCodegen.before.mir

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ fn hello() -> () {
44
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14
55

66
bb0: {
7-
_0 = const (); // scope 0 at $DIR/control-flow-simplification.rs:14:6: 14:6
87
return; // scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2
98
}
109
}

src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.32bit.mir

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ fn main() -> () {
2222
_2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
2323
StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
2424
_3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
25-
_0 = const (); // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
2625
StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2726
StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2827
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2

src/test/mir-opt/const_prop/optimizes_into_variable.main.SimplifyLocals.after.64bit.mir

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ fn main() -> () {
2222
_2 = const 3_i32; // scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
2323
StorageLive(_3); // scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
2424
_3 = const 42_u32; // scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
25-
_0 = const (); // scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
2625
StorageDead(_3); // scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2726
StorageDead(_2); // scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
2827
StorageDead(_1); // scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2

src/test/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
StorageLive(_6); // scope 3 at $DIR/cycle.rs:14:10: 14:11
5757
- _6 = _1; // scope 3 at $DIR/cycle.rs:14:10: 14:11
5858
+ _6 = _4; // scope 3 at $DIR/cycle.rs:14:10: 14:11
59-
_5 = const (); // scope 4 at $DIR/cycle.rs:14:5: 14:12
6059
StorageDead(_6); // scope 3 at $DIR/cycle.rs:14:11: 14:12
6160
StorageDead(_5); // scope 3 at $DIR/cycle.rs:14:12: 14:13
6261
_0 = const (); // scope 0 at $DIR/cycle.rs:8:11: 15:2

src/test/mir-opt/dest-prop/union.main.DestinationPropagation.diff

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
StorageLive(_3); // scope 1 at $DIR/union.rs:15:5: 15:27
3232
StorageLive(_4); // scope 1 at $DIR/union.rs:15:10: 15:26
3333
_4 = (_1.0: u32); // scope 2 at $DIR/union.rs:15:19: 15:24
34-
_3 = const (); // scope 3 at $DIR/union.rs:15:5: 15:27
3534
StorageDead(_4); // scope 1 at $DIR/union.rs:15:26: 15:27
3635
StorageDead(_3); // scope 1 at $DIR/union.rs:15:27: 15:28
3736
_0 = const (); // scope 0 at $DIR/union.rs:8:11: 16:2

src/test/mir-opt/inline/inline_compatibility.inlined_no_sanitize.Inline.diff

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
- }
1717
-
1818
- bb1: {
19-
+ _1 = const (); // scope 1 at $DIR/inline-compatibility.rs:24:5: 24:18
2019
StorageDead(_1); // scope 0 at $DIR/inline-compatibility.rs:24:18: 24:19
2120
_0 = const (); // scope 0 at $DIR/inline-compatibility.rs:23:37: 25:2
2221
return; // scope 0 at $DIR/inline-compatibility.rs:25:2: 25:2

src/test/mir-opt/inline/inline_compatibility.inlined_target_feature.Inline.diff

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
- }
1717
-
1818
- bb1: {
19-
+ _1 = const (); // scope 1 at $DIR/inline-compatibility.rs:13:5: 13:21
2019
StorageDead(_1); // scope 0 at $DIR/inline-compatibility.rs:13:21: 13:22
2120
_0 = const (); // scope 0 at $DIR/inline-compatibility.rs:12:40: 14:2
2221
return; // scope 0 at $DIR/inline-compatibility.rs:14:2: 14:2

src/test/mir-opt/inline/inline_cycle.two.Inline.diff

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
+ StorageDead(_5); // scope 1 at $DIR/inline-cycle.rs:49:5: 49:12
3838
+ StorageDead(_4); // scope 1 at $DIR/inline-cycle.rs:49:5: 49:12
3939
+ StorageDead(_3); // scope 1 at $DIR/inline-cycle.rs:49:5: 49:12
40-
+ _1 = const (); // scope 1 at $DIR/inline-cycle.rs:49:5: 49:12
4140
+ StorageDead(_2); // scope 0 at $DIR/inline-cycle.rs:49:5: 49:12
4241
StorageDead(_1); // scope 0 at $DIR/inline-cycle.rs:49:12: 49:13
4342
_0 = const (); // scope 0 at $DIR/inline-cycle.rs:48:10: 50:2

src/test/mir-opt/inline/inline_options.main.Inline.after.mir

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ fn main() -> () {
4848

4949
bb4: {
5050
StorageDead(_5); // scope 1 at $DIR/inline-options.rs:10:5: 10:21
51-
_2 = const (); // scope 1 at $DIR/inline-options.rs:10:5: 10:21
5251
StorageDead(_2); // scope 0 at $DIR/inline-options.rs:10:21: 10:22
5352
_0 = const (); // scope 0 at $DIR/inline-options.rs:8:11: 11:2
5453
return; // scope 0 at $DIR/inline-options.rs:11:2: 11:2

src/test/mir-opt/inline/issue_76997_inline_scopes_parenting.main.Inline.after.mir

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ fn main() -> () {
2828
StorageLive(_5); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
2929
_5 = move (_3.0: ()); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
3030
StorageLive(_6); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
31-
_6 = const (); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
32-
_0 = const (); // scope 3 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
3331
StorageDead(_6); // scope 2 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
3432
StorageDead(_5); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
3533
StorageDead(_4); // scope 1 at $DIR/issue-76997-inline-scopes-parenting.rs:6:9: 6:10

src/test/mir-opt/issue_73223.main.PreCodegen.32bit.diff

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
StorageDead(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
118118
StorageDead(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
119119
StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
120-
_0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2
121120
StorageDead(_4); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2
122121
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2
123122
return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2

src/test/mir-opt/issue_73223.main.PreCodegen.64bit.diff

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
StorageDead(_10); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
118118
StorageDead(_9); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
119119
StorageDead(_6); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
120-
_0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2
121120
StorageDead(_4); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2
122121
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2
123122
return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2

src/test/mir-opt/lower_intrinsics.f_u64.PreCodegen.before.mir

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ fn f_u64() -> () {
2727
StorageDead(_3); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
2828
StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:35:5: 35:21
2929
StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:35:5: 35:21
30-
_0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:34:16: 36:2
3130
return; // scope 0 at $DIR/lower_intrinsics.rs:36:2: 36:2
3231
}
3332
}

src/test/mir-opt/lower_intrinsics.f_unit.PreCodegen.before.mir

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ fn f_unit() -> () {
2222
bb1: {
2323
StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:29:5: 29:19
2424
StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:29:18: 29:19
25-
_0 = const (); // scope 0 at $DIR/lower_intrinsics.rs:28:17: 30:2
2625
return; // scope 0 at $DIR/lower_intrinsics.rs:30:2: 30:2
2726
}
2827
}

src/test/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff

-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
}
1414

1515
bb1: {
16-
_0 = const (); // scope 0 at $DIR/multiple_return_terminators.rs:5:10: 7:6
1716
goto -> bb3; // scope 0 at $DIR/multiple_return_terminators.rs:5:5: 9:6
1817
}
1918

2019
bb2: {
21-
_0 = const (); // scope 0 at $DIR/multiple_return_terminators.rs:7:12: 9:6
2220
goto -> bb3; // scope 0 at $DIR/multiple_return_terminators.rs:5:5: 9:6
2321
}
2422

src/test/mir-opt/remove_unneeded_drops.cannot_opt_generic.RemoveUnneededDrops.diff

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:21:5: 21:12
1515
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:21:10: 21:11
1616
_3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:21:10: 21:11
17-
_2 = const (); // scope 1 at $DIR/remove_unneeded_drops.rs:21:5: 21:12
1817
drop(_3) -> [return: bb2, unwind: bb1]; // scope 1 at $DIR/remove_unneeded_drops.rs:21:5: 21:12
1918
}
2019

src/test/mir-opt/remove_unneeded_drops.dont_opt.RemoveUnneededDrops.diff

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:9:5: 9:12
1515
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:9:10: 9:11
1616
_3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:9:10: 9:11
17-
_2 = const (); // scope 1 at $DIR/remove_unneeded_drops.rs:9:5: 9:12
1817
drop(_3) -> [return: bb2, unwind: bb1]; // scope 1 at $DIR/remove_unneeded_drops.rs:9:5: 9:12
1918
}
2019

src/test/mir-opt/remove_unneeded_drops.opt.RemoveUnneededDrops.diff

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:4:5: 4:12
1515
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:4:10: 4:11
1616
_3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:4:10: 4:11
17-
_2 = const (); // scope 1 at $DIR/remove_unneeded_drops.rs:4:5: 4:12
1817
- drop(_3) -> bb1; // scope 1 at $DIR/remove_unneeded_drops.rs:4:5: 4:12
1918
- }
2019
-

src/test/mir-opt/remove_unneeded_drops.opt_generic_copy.RemoveUnneededDrops.diff

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:14:5: 14:12
1515
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:14:10: 14:11
1616
_3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:14:10: 14:11
17-
_2 = const (); // scope 1 at $DIR/remove_unneeded_drops.rs:14:5: 14:12
1817
- drop(_3) -> bb1; // scope 1 at $DIR/remove_unneeded_drops.rs:14:5: 14:12
1918
- }
2019
-

src/test/mir-opt/simplify_locals.c.SimplifyLocals.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
- StorageDead(_3); // scope 1 at $DIR/simplify-locals.rs:16:25: 16:26
2626
- StorageDead(_4); // scope 1 at $DIR/simplify-locals.rs:16:26: 16:27
2727
- StorageDead(_2); // scope 1 at $DIR/simplify-locals.rs:16:26: 16:27
28-
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:13:8: 17:2
28+
- _0 = const (); // scope 0 at $DIR/simplify-locals.rs:13:8: 17:2
2929
StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:17:1: 17:2
3030
return; // scope 0 at $DIR/simplify-locals.rs:17:2: 17:2
3131
}

src/test/mir-opt/simplify_locals.d1.SimplifyLocals.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- StorageLive(_1); // scope 0 at $DIR/simplify-locals.rs:22:13: 22:17
1212
- discriminant(_1) = 0; // scope 0 at $DIR/simplify-locals.rs:22:13: 22:17
1313
- StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:22:17: 22:18
14-
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:20:9: 23:2
14+
- _0 = const (); // scope 0 at $DIR/simplify-locals.rs:20:9: 23:2
1515
return; // scope 0 at $DIR/simplify-locals.rs:23:2: 23:2
1616
}
1717
}

src/test/mir-opt/simplify_locals.d2.SimplifyLocals.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
- // + literal: Const { ty: E, val: Value(Scalar(0x01)) }
3232
- StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:28:25: 28:26
3333
- StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:28:26: 28:27
34-
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:26:9: 29:2
34+
- _0 = const (); // scope 0 at $DIR/simplify-locals.rs:26:9: 29:2
3535
return; // scope 0 at $DIR/simplify-locals.rs:29:2: 29:2
3636
}
3737
}

src/test/mir-opt/simplify_locals.r.SimplifyLocals.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- StorageLive(_3); // scope 2 at $DIR/simplify-locals.rs:36:13: 36:19
2424
- _3 = &mut _1; // scope 2 at $DIR/simplify-locals.rs:36:13: 36:19
2525
- StorageDead(_3); // scope 2 at $DIR/simplify-locals.rs:36:19: 36:20
26-
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:32:8: 37:2
26+
- _0 = const (); // scope 0 at $DIR/simplify-locals.rs:32:8: 37:2
2727
StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:37:1: 37:2
2828
return; // scope 0 at $DIR/simplify-locals.rs:37:2: 37:2
2929
}

src/test/mir-opt/simplify_locals.t1.SimplifyLocals.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
- _1 = (*_2); // scope 1 at $DIR/simplify-locals.rs:44:14: 44:15
1616
- StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:44:17: 44:18
1717
- StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:44:17: 44:18
18-
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:42:9: 45:2
18+
- _0 = const (); // scope 0 at $DIR/simplify-locals.rs:42:9: 45:2
1919
return; // scope 0 at $DIR/simplify-locals.rs:45:2: 45:2
2020
}
2121
}

src/test/mir-opt/simplify_locals.t2.SimplifyLocals.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
- _1 = &mut (*_2); // scope 1 at $DIR/simplify-locals.rs:50:14: 50:20
1616
- StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:50:22: 50:23
1717
- StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:50:22: 50:23
18-
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:48:9: 51:2
18+
- _0 = const (); // scope 0 at $DIR/simplify-locals.rs:48:9: 51:2
1919
return; // scope 0 at $DIR/simplify-locals.rs:51:2: 51:2
2020
}
2121
}

src/test/mir-opt/simplify_locals.t3.SimplifyLocals.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
- StorageDead(_3); // scope 0 at $DIR/simplify-locals.rs:56:23: 56:24
2020
- StorageDead(_2); // scope 0 at $DIR/simplify-locals.rs:56:23: 56:24
2121
- StorageDead(_1); // scope 0 at $DIR/simplify-locals.rs:56:23: 56:24
22-
_0 = const (); // scope 0 at $DIR/simplify-locals.rs:54:9: 57:2
22+
- _0 = const (); // scope 0 at $DIR/simplify-locals.rs:54:9: 57:2
2323
return; // scope 0 at $DIR/simplify-locals.rs:57:2: 57:2
2424
}
2525
}

src/test/mir-opt/simplify_locals_fixedpoint.foo.SimplifyLocals.diff

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131

3232
bb1: {
33-
_0 = const (); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:6: 8:6
33+
- _0 = const (); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:6: 8:6
3434
goto -> bb7; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6
3535
}
3636

@@ -51,12 +51,12 @@
5151
}
5252

5353
bb4: {
54-
_0 = const (); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:21: 7:10
54+
- _0 = const (); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:21: 7:10
5555
goto -> bb6; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:9: 7:10
5656
}
5757

5858
bb5: {
59-
_0 = const (); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:7:10: 7:10
59+
- _0 = const (); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:7:10: 7:10
6060
goto -> bb6; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:9: 7:10
6161
}
6262

src/test/mir-opt/simplify_locals_removes_unused_consts.main.SimplifyLocals.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
- StorageDead(_9); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:34: 16:35
7272
- StorageDead(_11); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:35: 16:36
7373
- StorageDead(_8); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:35: 16:36
74+
- _0 = const (); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:12:11: 17:2
7475
+ StorageDead(_2); // scope 1 at $DIR/simplify-locals-removes-unused-consts.rs:16:35: 16:36
75-
_0 = const (); // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:12:11: 17:2
7676
return; // scope 0 at $DIR/simplify-locals-removes-unused-consts.rs:17:2: 17:2
7777
}
7878
}

0 commit comments

Comments
 (0)