Skip to content

Commit 2837727

Browse files
committed
Replace legacy ConstProp by GVN.
1 parent a03c972 commit 2837727

File tree

190 files changed

+1360
-1713
lines changed

Some content is hidden

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

190 files changed

+1360
-1713
lines changed

compiler/rustc_mir_transform/src/const_prop.rs

Lines changed: 11 additions & 515 deletions
Large diffs are not rendered by default.

compiler/rustc_mir_transform/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,6 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
590590
&separate_const_switch::SeparateConstSwitch,
591591
&gvn::GVN,
592592
&simplify::SimplifyLocals::AfterGVN,
593-
&const_prop::ConstProp,
594593
&dataflow_const_prop::DataflowConstProp,
595594
&const_debuginfo::ConstDebugInfo,
596595
&o1(simplify_branches::SimplifyConstCondition::AfterConstProp),

tests/codegen/inherit_overflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// compile-flags: -Zmir-enable-passes=+Inline,+ConstProp --crate-type lib
1+
// compile-flags: -Zmir-enable-passes=+Inline,+GVN --crate-type lib
22
// revisions: ASSERT NOASSERT
33
//[ASSERT] compile-flags: -Coverflow-checks=on
44
//[NOASSERT] compile-flags: -Coverflow-checks=off

tests/mir-opt/const_allocation.main.ConstProp.after.32bit.mir renamed to tests/mir-opt/const_allocation.main.GVN.after.32bit.mir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `main` after ConstProp
1+
// MIR for `main` after GVN
22

33
fn main() -> () {
44
let mut _0: ();
@@ -7,10 +7,10 @@ fn main() -> () {
77

88
bb0: {
99
StorageLive(_1);
10-
StorageLive(_2);
10+
nop;
1111
_2 = const {ALLOC9: &&[(Option<i32>, &[&str])]};
1212
_1 = (*_2);
13-
StorageDead(_2);
13+
nop;
1414
StorageDead(_1);
1515
_0 = const ();
1616
return;

tests/mir-opt/const_allocation.main.ConstProp.after.64bit.mir renamed to tests/mir-opt/const_allocation.main.GVN.after.64bit.mir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `main` after ConstProp
1+
// MIR for `main` after GVN
22

33
fn main() -> () {
44
let mut _0: ();
@@ -7,10 +7,10 @@ fn main() -> () {
77

88
bb0: {
99
StorageLive(_1);
10-
StorageLive(_2);
10+
nop;
1111
_2 = const {ALLOC9: &&[(Option<i32>, &[&str])]};
1212
_1 = (*_2);
13-
StorageDead(_2);
13+
nop;
1414
StorageDead(_1);
1515
_0 = const ();
1616
return;

tests/mir-opt/const_allocation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// skip-filecheck
2-
// unit-test: ConstProp
2+
// unit-test: GVN
33
// ignore-endian-big
44
// EMIT_MIR_FOR_EACH_BIT_WIDTH
55
static FOO: &[(Option<i32>, &[&str])] =
66
&[(None, &[]), (None, &["foo", "bar"]), (Some(42), &["meh", "mop", "möp"])];
77

8-
// EMIT_MIR const_allocation.main.ConstProp.after.mir
8+
// EMIT_MIR const_allocation.main.GVN.after.mir
99
fn main() {
1010
FOO;
1111
}

tests/mir-opt/const_allocation2.main.ConstProp.after.32bit.mir renamed to tests/mir-opt/const_allocation2.main.GVN.after.32bit.mir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `main` after ConstProp
1+
// MIR for `main` after GVN
22

33
fn main() -> () {
44
let mut _0: ();
@@ -7,10 +7,10 @@ fn main() -> () {
77

88
bb0: {
99
StorageLive(_1);
10-
StorageLive(_2);
10+
nop;
1111
_2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]};
1212
_1 = (*_2);
13-
StorageDead(_2);
13+
nop;
1414
StorageDead(_1);
1515
_0 = const ();
1616
return;

tests/mir-opt/const_allocation2.main.ConstProp.after.64bit.mir renamed to tests/mir-opt/const_allocation2.main.GVN.after.64bit.mir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `main` after ConstProp
1+
// MIR for `main` after GVN
22

33
fn main() -> () {
44
let mut _0: ();
@@ -7,10 +7,10 @@ fn main() -> () {
77

88
bb0: {
99
StorageLive(_1);
10-
StorageLive(_2);
10+
nop;
1111
_2 = const {ALLOC9: &&[(Option<i32>, &[&u8])]};
1212
_1 = (*_2);
13-
StorageDead(_2);
13+
nop;
1414
StorageDead(_1);
1515
_0 = const ();
1616
return;

tests/mir-opt/const_allocation2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// skip-filecheck
2-
// unit-test: ConstProp
2+
// unit-test: GVN
33
// ignore-endian-big
44
// EMIT_MIR_FOR_EACH_BIT_WIDTH
5-
// EMIT_MIR const_allocation2.main.ConstProp.after.mir
5+
// EMIT_MIR const_allocation2.main.GVN.after.mir
66
fn main() {
77
FOO;
88
}

tests/mir-opt/const_allocation3.main.ConstProp.after.32bit.mir renamed to tests/mir-opt/const_allocation3.main.GVN.after.32bit.mir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// MIR for `main` after ConstProp
1+
// MIR for `main` after GVN
22

33
fn main() -> () {
44
let mut _0: ();
@@ -7,10 +7,10 @@ fn main() -> () {
77

88
bb0: {
99
StorageLive(_1);
10-
StorageLive(_2);
10+
nop;
1111
_2 = const {ALLOC4: &&Packed};
1212
_1 = (*_2);
13-
StorageDead(_2);
13+
nop;
1414
StorageDead(_1);
1515
_0 = const ();
1616
return;

0 commit comments

Comments
 (0)