Skip to content

Commit b1fdb4b

Browse files
committed
Do not optimize stable-mir ui tests.
1 parent bab9c75 commit b1fdb4b

File tree

6 files changed

+472
-189
lines changed

6 files changed

+472
-189
lines changed

tests/ui/stable-mir-print/async-closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -Z unpretty=stable-mir --crate-type lib -C panic=abort
1+
//@ compile-flags: -Z unpretty=stable-mir --crate-type lib -C panic=abort -Zmir-opt-level=0
22
//@ check-pass
33
//@ only-x86_64
44
//@ edition: 2024

tests/ui/stable-mir-print/async-closure.stdout

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,62 @@ fn foo() -> () {
88
debug y => _1;
99
debug x => _2;
1010
bb0: {
11+
StorageLive(_1);
1112
_1 = 0_i32;
13+
StorageLive(_2);
14+
StorageLive(_3);
1215
_3 = &_1;
1316
_2 = {coroutine-closure@$DIR/async-closure.rs:9:13: 9:21}(move _3);
17+
StorageDead(_3);
18+
_0 = ();
19+
StorageDead(_2);
20+
StorageDead(_1);
1421
return;
1522
}
1623
}
1724
fn foo::{closure#0}(_1: &{async closure@$DIR/async-closure.rs:9:13: 9:21}) -> {async closure body@$DIR/async-closure.rs:9:22: 11:6} {
1825
let mut _0: {async closure body@$DIR/async-closure.rs:9:22: 11:6};
1926
let mut _2: &i32;
27+
let mut _3: &i32;
2028
debug y => (*((*_1).0: &i32));
2129
bb0: {
22-
_2 = CopyForDeref(((*_1).0: &i32));
23-
_0 = {coroutine@$DIR/async-closure.rs:9:22: 11:6}(_2);
30+
StorageLive(_2);
31+
_3 = CopyForDeref(((*_1).0: &i32));
32+
_2 = &(*_3);
33+
_0 = {coroutine@$DIR/async-closure.rs:9:22: 11:6}(move _2);
34+
StorageDead(_2);
2435
return;
2536
}
2637
}
2738
fn foo::{closure#0}::{closure#0}(_1: Pin<&mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}>, _2: &mut Context<'_>) -> Poll<()> {
2839
let mut _0: Poll<()>;
2940
let _3: i32;
3041
let mut _4: &i32;
31-
let mut _5: u32;
32-
let mut _6: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
33-
let mut _7: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
42+
let mut _5: ();
43+
let mut _6: &mut Context<'_>;
44+
let mut _7: u32;
3445
let mut _8: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
35-
debug _task_context => _2;
46+
let mut _9: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
47+
let mut _10: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
48+
debug _task_context => _6;
3649
debug y => (*((*(_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6})).0: &i32));
3750
debug y => _3;
3851
bb0: {
39-
_6 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
40-
_5 = discriminant((*_6));
41-
switchInt(move _5) -> [0: bb1, 1: bb2, otherwise: bb3];
52+
_8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
53+
_7 = discriminant((*_8));
54+
switchInt(move _7) -> [0: bb1, 1: bb2, otherwise: bb3];
4255
}
4356
bb1: {
44-
_7 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
45-
_4 = CopyForDeref(((*_7).0: &i32));
57+
_6 = move _2;
58+
StorageLive(_3);
59+
_9 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
60+
_4 = CopyForDeref(((*_9).0: &i32));
4661
_3 = (*_4);
47-
_0 = std::task::Poll::Ready(());
48-
_8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
49-
discriminant((*_8) = 1;
62+
_5 = ();
63+
StorageDead(_3);
64+
_0 = std::task::Poll::Ready(move _5);
65+
_10 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
66+
discriminant((*_10) = 1;
5067
return;
5168
}
5269
bb2: {
@@ -60,25 +77,31 @@ fn foo::{closure#0}::{synthetic#0}(_1: Pin<&mut {async closure body@$DIR/async-c
6077
let mut _0: Poll<()>;
6178
let _3: i32;
6279
let mut _4: &i32;
63-
let mut _5: u32;
64-
let mut _6: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
65-
let mut _7: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
80+
let mut _5: ();
81+
let mut _6: &mut Context<'_>;
82+
let mut _7: u32;
6683
let mut _8: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
67-
debug _task_context => _2;
84+
let mut _9: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
85+
let mut _10: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
86+
debug _task_context => _6;
6887
debug y => (*((*(_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6})).0: &i32));
6988
debug y => _3;
7089
bb0: {
71-
_6 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
72-
_5 = discriminant((*_6));
73-
switchInt(move _5) -> [0: bb1, 1: bb2, otherwise: bb3];
90+
_8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
91+
_7 = discriminant((*_8));
92+
switchInt(move _7) -> [0: bb1, 1: bb2, otherwise: bb3];
7493
}
7594
bb1: {
76-
_7 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
77-
_4 = CopyForDeref(((*_7).0: &i32));
95+
_6 = move _2;
96+
StorageLive(_3);
97+
_9 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
98+
_4 = CopyForDeref(((*_9).0: &i32));
7899
_3 = (*_4);
79-
_0 = std::task::Poll::Ready(());
80-
_8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
81-
discriminant((*_8) = 1;
100+
_5 = ();
101+
StorageDead(_3);
102+
_0 = std::task::Poll::Ready(move _5);
103+
_10 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
104+
discriminant((*_10) = 1;
82105
return;
83106
}
84107
bb2: {

tests/ui/stable-mir-print/basic_function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -Z unpretty=stable-mir -Z mir-opt-level=3
1+
//@ compile-flags: -Z unpretty=stable-mir -Zmir-opt-level=0
22
//@ check-pass
33
//@ only-x86_64
44
//@ needs-unwind unwind edges are different with panic=abort

tests/ui/stable-mir-print/basic_function.stdout

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
// If you find a bug or want to improve the output open a issue at https://github.com/rust-lang/project-stable-mir.
33
fn foo(_1: i32) -> i32 {
44
let mut _0: i32;
5-
let mut _2: (i32, bool);
5+
let mut _2: i32;
6+
let mut _3: (i32, bool);
67
debug i => _1;
78
bb0: {
8-
_2 = CheckedAdd(_1, 1_i32);
9-
assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", _1, 1_i32) -> [success: bb1, unwind continue];
9+
StorageLive(_2);
10+
_2 = _1;
11+
_3 = CheckedAdd(_2, 1_i32);
12+
assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, 1_i32) -> [success: bb1, unwind continue];
1013
}
1114
bb1: {
12-
_0 = move (_2.0: i32);
15+
_0 = move (_3.0: i32);
16+
StorageDead(_2);
1317
return;
1418
}
1519
}
@@ -22,15 +26,23 @@ fn bar(_1: &mut Vec<i32>) -> Vec<i32> {
2226
debug vec => _1;
2327
debug new_vec => _2;
2428
bb0: {
29+
StorageLive(_2);
30+
StorageLive(_3);
2531
_3 = &(*_1);
2632
_2 = <Vec<i32> as Clone>::clone(move _3) -> [return: bb1, unwind continue];
2733
}
2834
bb1: {
35+
StorageDead(_3);
36+
StorageLive(_4);
37+
StorageLive(_5);
2938
_5 = &mut _2;
3039
_4 = Vec::<i32>::push(move _5, 1_i32) -> [return: bb2, unwind: bb3];
3140
}
3241
bb2: {
42+
StorageDead(_5);
43+
StorageDead(_4);
3344
_0 = move _2;
45+
StorageDead(_2);
3446
return;
3547
}
3648
bb3: {
@@ -69,6 +81,7 @@ fn demux(_1: u8) -> u8 {
6981
fn main() -> () {
7082
let mut _0: ();
7183
bb0: {
84+
_0 = ();
7285
return;
7386
}
7487
}

tests/ui/stable-mir-print/operands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -Z unpretty=stable-mir --crate-type lib -C panic=abort
1+
//@ compile-flags: -Z unpretty=stable-mir --crate-type lib -C panic=abort -Zmir-opt-level=0
22
//@ check-pass
33
//@ only-x86_64
44
//@ needs-unwind unwind edges are different with panic=abort

0 commit comments

Comments
 (0)