diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-01-15 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2021-01-18 13:15:27 +0100 |
| commit | a9292d871c09bbfc2924dc6e7358fde3ba564d51 (patch) | |
| tree | 60dd358b95ca69a96d7040c69afdbb77762525b9 /src/test | |
| parent | 86e0ff47a0d1afcbe9f0c8cdb54f60bb18da20df (diff) | |
| download | rust-a9292d871c09bbfc2924dc6e7358fde3ba564d51.tar.gz rust-a9292d871c09bbfc2924dc6e7358fde3ba564d51.zip | |
Remove disabled transformation from instcombine
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir | 2 | ||||
| -rw-r--r-- | src/test/mir-opt/inst_combine_deref.rs | 69 |
2 files changed, 1 insertions, 70 deletions
diff --git a/src/test/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir b/src/test/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir index db504b416fe..4bda9ae383c 100644 --- a/src/test/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir +++ b/src/test/mir-opt/inline/inline_closure_borrows_arg.foo.Inline.after.mir @@ -40,7 +40,7 @@ fn foo(_1: T, _2: &i32) -> i32 { _9 = move (_5.1: &i32); // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 StorageLive(_10); // scope 2 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 _10 = _8; // scope 2 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 - _0 = (*_8); // scope 3 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 + _0 = (*_10); // scope 3 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 StorageDead(_10); // scope 2 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 StorageDead(_9); // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 StorageDead(_8); // scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12 diff --git a/src/test/mir-opt/inst_combine_deref.rs b/src/test/mir-opt/inst_combine_deref.rs deleted file mode 100644 index 78361c33660..00000000000 --- a/src/test/mir-opt/inst_combine_deref.rs +++ /dev/null @@ -1,69 +0,0 @@ -// compile-flags: -O -Zunsound-mir-opts -// EMIT_MIR inst_combine_deref.simple_opt.InstCombine.diff -fn simple_opt() -> u64 { - let x = 5; - let y = &x; - let z = *y; - z -} - -// EMIT_MIR inst_combine_deref.deep_opt.InstCombine.diff -fn deep_opt() -> (u64, u64, u64) { - let x1 = 1; - let x2 = 2; - let x3 = 3; - let y1 = &x1; - let y2 = &x2; - let y3 = &x3; - let z1 = *y1; - let z2 = *y2; - let z3 = *y3; - (z1, z2, z3) -} - -struct S { - a: u64, - b: u64, -} - -// EMIT_MIR inst_combine_deref.opt_struct.InstCombine.diff -fn opt_struct(s: S) -> u64 { - let a = &s.a; - let b = &s.b; - let x = *a; - *b + x -} - -// EMIT_MIR inst_combine_deref.dont_opt.InstCombine.diff -// do not optimize a sequence looking like this: -// _1 = &_2; -// _1 = _3; -// _4 = *_1; -// as the _1 = _3 assignment makes it not legal to replace the last statement with _4 = _2 -fn dont_opt() -> u64 { - let y = 5; - let _ref = &y; - let x = 5; - let mut _1 = &x; - _1 = _ref; - let _4 = *_1; - 0 -} - -// EMIT_MIR inst_combine_deref.do_not_miscompile.InstCombine.diff -fn do_not_miscompile() { - let x = 42; - let a = 99; - let mut y = &x; - let z = &mut y; - *z = &a; - assert!(*y == 99); -} - -fn main() { - simple_opt(); - deep_opt(); - opt_struct(S { a: 0, b: 1 }); - dont_opt(); - do_not_miscompile(); -} |
