You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #139042 - compiler-errors:do-not-optimize-switchint, r=<try>
Do not remove trivial `SwitchInt` with mir-opt-level=0
When mir-opt-level=0, do not optimize out `SwitchInt` terminators that all have the same terminator since it may remove a read which affects miri's ability to detect UB on that operand.
cc `@RalfJung`
Fixesrust-lang/miri#4237
This affects some tests... I guess I could mark them as `mir-opt-level=1`? Not sure.
Copy file name to clipboardExpand all lines: tests/mir-opt/early_otherwise_branch_unwind.poll.EarlyOtherwiseBranch.diff
+6-4
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@
12
12
let mut _7: bool;
13
13
let mut _8: bool;
14
14
let mut _9: isize;
15
+
let mut _10: isize;
15
16
scope 1 {
16
17
debug _trailers => _5;
17
18
}
@@ -99,12 +100,13 @@
99
100
}
100
101
101
102
bb15: {
102
-
goto -> bb14;
103
+
_9 = discriminant(((((_1 as Ready).0: std::result::Result<std::option::Option<std::vec::Vec<u8>>, u8>) as Ok).0: std::option::Option<std::vec::Vec<u8>>));
104
+
switchInt(move _9) -> [1: bb14, otherwise: bb14];
103
105
}
104
106
105
107
bb16: {
106
-
_9 = discriminant(((_1 as Ready).0: std::result::Result<std::option::Option<std::vec::Vec<u8>>, u8>));
107
-
switchInt(move _9) -> [0: bb13, otherwise: bb12];
108
+
_10 = discriminant(((_1 as Ready).0: std::result::Result<std::option::Option<std::vec::Vec<u8>>, u8>));
0 commit comments