Skip to content

Commit 4a33bf3

Browse files
committed
Simplify MIR opt tests
This commit removes many cases of MIR opt tests emitting `.diff`s for more than one pass. These tests cannot be `unit-test`s, and so they are easy to break, and they also provide little value due to having excessively strong opinions over *how* a piece of code should be optimized. Where reasonable, we instead add separate test files that only emit the `PreCodegen.after` MIR for code where we want to track what the result of the net result of the optimization pipeline's output is.
1 parent 9f4d5d2 commit 4a33bf3

File tree

53 files changed

+733
-1502
lines changed

Some content is hidden

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

53 files changed

+733
-1502
lines changed

src/test/mir-opt/early_otherwise_branch_68867.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// compile-flags: -Z mir-opt-level=4 -Zunsound-mir-opts
1+
// unit-test: EarlyOtherwiseBranch
2+
3+
// FIXME: This test was broken by the derefer change.
24

35
// example from #68867
46
type CSSFloat = f32;
@@ -11,7 +13,6 @@ pub enum ViewportPercentageLength {
1113
}
1214

1315
// EMIT_MIR early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff
14-
// EMIT_MIR early_otherwise_branch_68867.try_sum EarlyOtherwiseBranch.before SimplifyConstCondition-final.after
1516
#[no_mangle]
1617
pub extern "C" fn try_sum(
1718
x: &ViewportPercentageLength,

src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.before-SimplifyConstCondition-final.after.diff

-322
This file was deleted.

src/test/mir-opt/early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff

+6-6
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
StorageDead(_5); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:23: +5:24
8181
_34 = deref_copy (_4.0: &ViewportPercentageLength); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
8282
_11 = discriminant((*_34)); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:14: +5:24
83-
switchInt(move _11) -> [0_isize: bb1, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb11]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
83+
switchInt(move _11) -> [0_isize: bb1, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb2]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:8: +5:24
8484
}
8585

8686
bb1: {
@@ -91,14 +91,14 @@
9191

9292
bb2: {
9393
StorageLive(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:25: +10:27
94-
nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:25: +10:27
94+
Deinit(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:25: +10:27
9595
Deinit(_0); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:21: +10:28
96-
nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:21: +10:28
96+
((_0 as Err).0: ()) = move _33; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:21: +10:28
9797
discriminant(_0) = 1; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:21: +10:28
9898
StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+10:27: +10:28
9999
StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+11:6: +11:7
100100
StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:1: +12:2
101-
return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2
101+
goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2
102102
}
103103

104104
bb3: {
@@ -221,11 +221,11 @@
221221
discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+5:5: +11:7
222222
StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+11:6: +11:7
223223
StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:1: +12:2
224-
return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2
224+
goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2
225225
}
226226

227227
bb11: {
228-
unreachable; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2
228+
return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:+12:2: +12:2
229229
}
230230
}
231231

src/test/mir-opt/issue-73223.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ fn main() {
1010

1111
// EMIT_MIR_FOR_EACH_BIT_WIDTH
1212
// EMIT_MIR issue_73223.main.SimplifyArmIdentity.diff
13-
// EMIT_MIR issue_73223.main.PreCodegen.diff

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

-117
This file was deleted.

0 commit comments

Comments
 (0)