Skip to content

Commit 0da8676

Browse files
committed
Run InstSimplify before UnreachablePropagation
1 parent 5baf1e1 commit 0da8676

File tree

57 files changed

+147
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+147
-149
lines changed

compiler/rustc_mir_transform/src/instsimplify.rs

+42-25
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,59 @@ use rustc_span::symbol::Symbol;
1111
use rustc_target::abi::FieldIdx;
1212
use rustc_target::spec::abi::Abi;
1313

14-
pub struct InstSimplify;
14+
pub enum InstSimplify {
15+
BeforeUnreachablePropagation,
16+
Final,
17+
}
1518

1619
impl<'tcx> MirPass<'tcx> for InstSimplify {
20+
fn name(&self) -> &'static str {
21+
match &self {
22+
InstSimplify::BeforeUnreachablePropagation => {
23+
"InstSimplify-before-unreachable-propagation"
24+
}
25+
InstSimplify::Final => "InstSimplify-final",
26+
}
27+
}
28+
1729
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
1830
sess.mir_opt_level() > 0
1931
}
2032

2133
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
22-
let ctx = InstSimplifyContext {
23-
tcx,
24-
local_decls: &body.local_decls,
25-
param_env: tcx.param_env_reveal_all_normalized(body.source.def_id()),
26-
};
27-
let preserve_ub_checks =
28-
attr::contains_name(tcx.hir().krate_attrs(), sym::rustc_preserve_ub_checks);
29-
for block in body.basic_blocks.as_mut() {
30-
for statement in block.statements.iter_mut() {
31-
match statement.kind {
32-
StatementKind::Assign(box (_place, ref mut rvalue)) => {
33-
if !preserve_ub_checks {
34-
ctx.simplify_ub_check(&statement.source_info, rvalue);
35-
}
36-
ctx.simplify_bool_cmp(&statement.source_info, rvalue);
37-
ctx.simplify_ref_deref(&statement.source_info, rvalue);
38-
ctx.simplify_len(&statement.source_info, rvalue);
39-
ctx.simplify_cast(rvalue);
34+
inst_simplify(tcx, body);
35+
}
36+
}
37+
38+
fn inst_simplify<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
39+
let ctx = InstSimplifyContext {
40+
tcx,
41+
local_decls: &body.local_decls,
42+
param_env: tcx.param_env_reveal_all_normalized(body.source.def_id()),
43+
};
44+
let preserve_ub_checks =
45+
attr::contains_name(tcx.hir().krate_attrs(), sym::rustc_preserve_ub_checks);
46+
for block in body.basic_blocks.as_mut() {
47+
for statement in block.statements.iter_mut() {
48+
match statement.kind {
49+
StatementKind::Assign(box (_place, ref mut rvalue)) => {
50+
if !preserve_ub_checks {
51+
ctx.simplify_ub_check(&statement.source_info, rvalue);
4052
}
41-
_ => {}
53+
ctx.simplify_bool_cmp(&statement.source_info, rvalue);
54+
ctx.simplify_ref_deref(&statement.source_info, rvalue);
55+
ctx.simplify_len(&statement.source_info, rvalue);
56+
ctx.simplify_cast(rvalue);
4257
}
58+
_ => {}
4359
}
44-
45-
ctx.simplify_primitive_clone(block.terminator.as_mut().unwrap(), &mut block.statements);
46-
ctx.simplify_intrinsic_assert(block.terminator.as_mut().unwrap());
47-
ctx.simplify_nounwind_call(block.terminator.as_mut().unwrap());
48-
simplify_duplicate_switch_targets(block.terminator.as_mut().unwrap());
4960
}
61+
62+
let terminator = block.terminator.as_mut().unwrap();
63+
ctx.simplify_primitive_clone(terminator, &mut block.statements);
64+
ctx.simplify_intrinsic_assert(terminator);
65+
ctx.simplify_nounwind_call(terminator);
66+
simplify_duplicate_switch_targets(terminator);
5067
}
5168
}
5269

compiler/rustc_mir_transform/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
581581
&remove_unneeded_drops::RemoveUnneededDrops,
582582
// Type instantiation may create uninhabited enums.
583583
&uninhabited_enum_branching::UninhabitedEnumBranching,
584+
&instsimplify::InstSimplify::BeforeUnreachablePropagation,
584585
&unreachable_prop::UnreachablePropagation,
585586
&o1(simplify::SimplifyCfg::AfterUninhabitedEnumBranching),
586587
// Inlining may have introduced a lot of redundant code and a large move pattern.
@@ -591,9 +592,9 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
591592
&ref_prop::ReferencePropagation,
592593
&sroa::ScalarReplacementOfAggregates,
593594
&match_branches::MatchBranchSimplification,
594-
// inst combine is after MatchBranchSimplification to clean up Ne(_1, false)
595+
// InstSimplify is after MatchBranchSimplification to clean up Ne(_1, false)
595596
&multiple_return_terminators::MultipleReturnTerminators,
596-
&instsimplify::InstSimplify,
597+
&instsimplify::InstSimplify::Final,
597598
&simplify::SimplifyLocals::BeforeConstProp,
598599
&dead_store_elimination::DeadStoreElimination::Initial,
599600
&gvn::GVN,

tests/mir-opt/const_prop/slice_len.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ unit-test: GVN
2-
//@ compile-flags: -Zmir-enable-passes=+InstSimplify
2+
//@ compile-flags: -Zmir-enable-passes=+InstSimplify-before-unreachable-propagation
33
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
44
// EMIT_MIR_FOR_EACH_BIT_WIDTH
55

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
22
//@ unit-test: DataflowConstProp
3-
//@ compile-flags: -Zmir-enable-passes=+InstSimplify
3+
//@ compile-flags: -Zmir-enable-passes=+InstSimplify-before-unreachable-propagation
44
// EMIT_MIR_FOR_EACH_BIT_WIDTH
55

66
// EMIT_MIR slice_len.main.DataflowConstProp.diff

tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify.diff renamed to tests/mir-opt/instsimplify/bool_compare.eq_false.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `eq_false` before InstSimplify
2-
+ // MIR for `eq_false` after InstSimplify
1+
- // MIR for `eq_false` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `eq_false` after InstSimplify-before-unreachable-propagation
33

44
fn eq_false(_1: bool) -> u32 {
55
debug x => _1;

tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify.diff renamed to tests/mir-opt/instsimplify/bool_compare.eq_true.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `eq_true` before InstSimplify
2-
+ // MIR for `eq_true` after InstSimplify
1+
- // MIR for `eq_true` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `eq_true` after InstSimplify-before-unreachable-propagation
33

44
fn eq_true(_1: bool) -> u32 {
55
debug x => _1;

tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify.diff renamed to tests/mir-opt/instsimplify/bool_compare.false_eq.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `false_eq` before InstSimplify
2-
+ // MIR for `false_eq` after InstSimplify
1+
- // MIR for `false_eq` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `false_eq` after InstSimplify-before-unreachable-propagation
33

44
fn false_eq(_1: bool) -> u32 {
55
debug x => _1;

tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify.diff renamed to tests/mir-opt/instsimplify/bool_compare.false_ne.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `false_ne` before InstSimplify
2-
+ // MIR for `false_ne` after InstSimplify
1+
- // MIR for `false_ne` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `false_ne` after InstSimplify-before-unreachable-propagation
33

44
fn false_ne(_1: bool) -> u32 {
55
debug x => _1;

tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify.diff renamed to tests/mir-opt/instsimplify/bool_compare.ne_false.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `ne_false` before InstSimplify
2-
+ // MIR for `ne_false` after InstSimplify
1+
- // MIR for `ne_false` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `ne_false` after InstSimplify-before-unreachable-propagation
33

44
fn ne_false(_1: bool) -> u32 {
55
debug x => _1;

tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify.diff renamed to tests/mir-opt/instsimplify/bool_compare.ne_true.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `ne_true` before InstSimplify
2-
+ // MIR for `ne_true` after InstSimplify
1+
- // MIR for `ne_true` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `ne_true` after InstSimplify-before-unreachable-propagation
33

44
fn ne_true(_1: bool) -> u32 {
55
debug x => _1;

tests/mir-opt/instsimplify/bool_compare.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
//@ unit-test: InstSimplify
1+
//@ unit-test: InstSimplify-before-unreachable-propagation
22

3-
// EMIT_MIR bool_compare.eq_true.InstSimplify.diff
3+
// EMIT_MIR bool_compare.eq_true.InstSimplify-before-unreachable-propagation.diff
44
fn eq_true(x: bool) -> u32 {
55
// CHECK-LABEL: fn eq_true(
66
// CHECK-NOT: Eq(
77
if x == true { 0 } else { 1 }
88
}
99

10-
// EMIT_MIR bool_compare.true_eq.InstSimplify.diff
10+
// EMIT_MIR bool_compare.true_eq.InstSimplify-before-unreachable-propagation.diff
1111
fn true_eq(x: bool) -> u32 {
1212
// CHECK-LABEL: fn true_eq(
1313
// CHECK-NOT: Eq(
1414
if true == x { 0 } else { 1 }
1515
}
1616

17-
// EMIT_MIR bool_compare.ne_true.InstSimplify.diff
17+
// EMIT_MIR bool_compare.ne_true.InstSimplify-before-unreachable-propagation.diff
1818
fn ne_true(x: bool) -> u32 {
1919
// CHECK-LABEL: fn ne_true(
2020
// CHECK: Not(
2121
if x != true { 0 } else { 1 }
2222
}
2323

24-
// EMIT_MIR bool_compare.true_ne.InstSimplify.diff
24+
// EMIT_MIR bool_compare.true_ne.InstSimplify-before-unreachable-propagation.diff
2525
fn true_ne(x: bool) -> u32 {
2626
// CHECK-LABEL: fn true_ne(
2727
// CHECK: Not(
2828
if true != x { 0 } else { 1 }
2929
}
3030

31-
// EMIT_MIR bool_compare.eq_false.InstSimplify.diff
31+
// EMIT_MIR bool_compare.eq_false.InstSimplify-before-unreachable-propagation.diff
3232
fn eq_false(x: bool) -> u32 {
3333
// CHECK-LABEL: fn eq_false(
3434
// CHECK: Not(
3535
if x == false { 0 } else { 1 }
3636
}
3737

38-
// EMIT_MIR bool_compare.false_eq.InstSimplify.diff
38+
// EMIT_MIR bool_compare.false_eq.InstSimplify-before-unreachable-propagation.diff
3939
fn false_eq(x: bool) -> u32 {
4040
// CHECK-LABEL: fn false_eq(
4141
// CHECK: Not(
4242
if false == x { 0 } else { 1 }
4343
}
4444

45-
// EMIT_MIR bool_compare.ne_false.InstSimplify.diff
45+
// EMIT_MIR bool_compare.ne_false.InstSimplify-before-unreachable-propagation.diff
4646
fn ne_false(x: bool) -> u32 {
4747
// CHECK-LABEL: fn ne_false(
4848
// CHECK-NOT: Ne(
4949
if x != false { 0 } else { 1 }
5050
}
5151

52-
// EMIT_MIR bool_compare.false_ne.InstSimplify.diff
52+
// EMIT_MIR bool_compare.false_ne.InstSimplify-before-unreachable-propagation.diff
5353
fn false_ne(x: bool) -> u32 {
5454
// CHECK-LABEL: fn false_ne(
5555
// CHECK-NOT: Ne(

tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify.diff renamed to tests/mir-opt/instsimplify/bool_compare.true_eq.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `true_eq` before InstSimplify
2-
+ // MIR for `true_eq` after InstSimplify
1+
- // MIR for `true_eq` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `true_eq` after InstSimplify-before-unreachable-propagation
33

44
fn true_eq(_1: bool) -> u32 {
55
debug x => _1;

tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify.diff renamed to tests/mir-opt/instsimplify/bool_compare.true_ne.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `true_ne` before InstSimplify
2-
+ // MIR for `true_ne` after InstSimplify
1+
- // MIR for `true_ne` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `true_ne` after InstSimplify-before-unreachable-propagation
33

44
fn true_ne(_1: bool) -> u32 {
55
debug x => _1;

tests/mir-opt/instsimplify/casts.redundant.InstSimplify.diff renamed to tests/mir-opt/instsimplify/casts.redundant.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `redundant` before InstSimplify
2-
+ // MIR for `redundant` after InstSimplify
1+
- // MIR for `redundant` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `redundant` after InstSimplify-before-unreachable-propagation
33

44
fn redundant(_1: *const &u8) -> *const &u8 {
55
debug x => _1;

tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify.diff renamed to tests/mir-opt/instsimplify/casts.roundtrip.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `roundtrip` before InstSimplify
2-
+ // MIR for `roundtrip` after InstSimplify
1+
- // MIR for `roundtrip` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `roundtrip` after InstSimplify-before-unreachable-propagation
33

44
fn roundtrip(_1: *const u8) -> *const u8 {
55
debug x => _1;

tests/mir-opt/instsimplify/casts.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: InstSimplify
1+
//@ unit-test: InstSimplify-before-unreachable-propagation
22
//@ compile-flags: -Zinline-mir
33
#![crate_type = "lib"]
44

@@ -7,15 +7,15 @@ fn generic_cast<T, U>(x: *const T) -> *const U {
77
x as *const U
88
}
99

10-
// EMIT_MIR casts.redundant.InstSimplify.diff
10+
// EMIT_MIR casts.redundant.InstSimplify-before-unreachable-propagation.diff
1111
pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 {
1212
// CHECK-LABEL: fn redundant(
1313
// CHECK: inlined generic_cast
1414
// CHECK-NOT: as
1515
generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8
1616
}
1717

18-
// EMIT_MIR casts.roundtrip.InstSimplify.diff
18+
// EMIT_MIR casts.roundtrip.InstSimplify-before-unreachable-propagation.diff
1919
pub fn roundtrip(x: *const u8) -> *const u8 {
2020
// CHECK-LABEL: fn roundtrip(
2121
// CHECK: _4 = _1;

tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-abort.diff renamed to tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-before-unreachable-propagation.panic-abort.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `norm2` before InstSimplify
2-
+ // MIR for `norm2` after InstSimplify
1+
- // MIR for `norm2` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `norm2` after InstSimplify-before-unreachable-propagation
33

44
fn norm2(_1: [f32; 2]) -> f32 {
55
debug x => _1;

tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify.panic-unwind.diff renamed to tests/mir-opt/instsimplify/combine_array_len.norm2.InstSimplify-before-unreachable-propagation.panic-unwind.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `norm2` before InstSimplify
2-
+ // MIR for `norm2` after InstSimplify
1+
- // MIR for `norm2` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `norm2` after InstSimplify-before-unreachable-propagation
33

44
fn norm2(_1: [f32; 2]) -> f32 {
55
debug x => _1;

tests/mir-opt/instsimplify/combine_array_len.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
2-
//@ unit-test: InstSimplify
2+
//@ unit-test: InstSimplify-before-unreachable-propagation
33

4-
// EMIT_MIR combine_array_len.norm2.InstSimplify.diff
4+
// EMIT_MIR combine_array_len.norm2.InstSimplify-before-unreachable-propagation.diff
55
fn norm2(x: [f32; 2]) -> f32 {
66
// CHECK-LABEL: fn norm2(
77
// CHECK-NOT: Len(

tests/mir-opt/instsimplify/combine_clone_of_primitives.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
//@ unit-test: InstSimplify
1+
//@ unit-test: InstSimplify-before-unreachable-propagation
22
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
33

4-
// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff
4+
// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify-before-unreachable-propagation.diff
55
#[derive(Clone)]
66
struct MyThing<T> {
77
v: T,

tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-abort.diff renamed to tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-before-unreachable-propagation.panic-abort.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify
2-
+ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify
1+
- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify-before-unreachable-propagation
33

44
fn <impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
55
debug self => _1;

tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.panic-unwind.diff renamed to tests/mir-opt/instsimplify/combine_clone_of_primitives.{impl#0}-clone.InstSimplify-before-unreachable-propagation.panic-unwind.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify
2-
+ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify
1+
- // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `<impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone` after InstSimplify-before-unreachable-propagation
33

44
fn <impl at $DIR/combine_clone_of_primitives.rs:5:10: 5:15>::clone(_1: &MyThing<T>) -> MyThing<T> {
55
debug self => _1;

tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify.diff renamed to tests/mir-opt/instsimplify/combine_transmutes.adt_transmutes.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `adt_transmutes` before InstSimplify
2-
+ // MIR for `adt_transmutes` after InstSimplify
1+
- // MIR for `adt_transmutes` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `adt_transmutes` after InstSimplify-before-unreachable-propagation
33

44
fn adt_transmutes() -> () {
55
let mut _0: ();

tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify.diff renamed to tests/mir-opt/instsimplify/combine_transmutes.identity_transmutes.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `identity_transmutes` before InstSimplify
2-
+ // MIR for `identity_transmutes` after InstSimplify
1+
- // MIR for `identity_transmutes` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `identity_transmutes` after InstSimplify-before-unreachable-propagation
33

44
fn identity_transmutes() -> () {
55
let mut _0: ();

tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify.diff renamed to tests/mir-opt/instsimplify/combine_transmutes.integer_transmutes.InstSimplify-before-unreachable-propagation.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- // MIR for `integer_transmutes` before InstSimplify
2-
+ // MIR for `integer_transmutes` after InstSimplify
1+
- // MIR for `integer_transmutes` before InstSimplify-before-unreachable-propagation
2+
+ // MIR for `integer_transmutes` after InstSimplify-before-unreachable-propagation
33

44
fn integer_transmutes() -> () {
55
let mut _0: ();

tests/mir-opt/instsimplify/combine_transmutes.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ unit-test: InstSimplify
1+
//@ unit-test: InstSimplify-before-unreachable-propagation
22
//@ compile-flags: -C panic=abort
33
#![crate_type = "lib"]
44
#![feature(core_intrinsics)]
@@ -8,7 +8,7 @@
88
use std::intrinsics::mir::*;
99
use std::mem::{MaybeUninit, ManuallyDrop, transmute};
1010

11-
// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify.diff
11+
// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify-before-unreachable-propagation.diff
1212
pub unsafe fn identity_transmutes() {
1313
// CHECK-LABEL: fn identity_transmutes(
1414
// CHECK-NOT: as i32 (Transmute);
@@ -20,7 +20,7 @@ pub unsafe fn identity_transmutes() {
2020
}
2121

2222
#[custom_mir(dialect = "runtime", phase = "initial")]
23-
// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify.diff
23+
// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify-before-unreachable-propagation.diff
2424
pub unsafe fn integer_transmutes() {
2525
// CHECK-LABEL: fn integer_transmutes(
2626
// CHECK-NOT: _i32 as u32 (Transmute);
@@ -44,7 +44,7 @@ pub unsafe fn integer_transmutes() {
4444
}
4545
}
4646

47-
// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify.diff
47+
// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify-before-unreachable-propagation.diff
4848
pub unsafe fn adt_transmutes() {
4949
// CHECK-LABEL: fn adt_transmutes(
5050
// CHECK: as u8 (Transmute);

0 commit comments

Comments
 (0)