only run RemoveZsts at mir-opt-level 3 and above
This commit is contained in:
parent
46fd49cdc3
commit
6960bc9696
14 changed files with 56 additions and 26 deletions
|
@ -8,6 +8,9 @@ pub struct RemoveZsts;
|
||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for RemoveZsts {
|
impl<'tcx> MirPass<'tcx> for RemoveZsts {
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
|
if tcx.sess.mir_opt_level() < 3 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let param_env = tcx.param_env(body.source.def_id());
|
let param_env = tcx.param_env(body.source.def_id());
|
||||||
let (basic_blocks, local_decls) = body.basic_blocks_and_local_decls_mut();
|
let (basic_blocks, local_decls) = body.basic_blocks_and_local_decls_mut();
|
||||||
for block in basic_blocks.iter_mut() {
|
for block in basic_blocks.iter_mut() {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
bb2: {
|
bb2: {
|
||||||
nop; // scope 0 at $DIR/control-flow-simplification.rs:14:6: 14:6
|
_0 = const (); // scope 0 at $DIR/control-flow-simplification.rs:14:6: 14:6
|
||||||
StorageDead(_1); // scope 0 at $DIR/control-flow-simplification.rs:14:5: 14:6
|
StorageDead(_1); // scope 0 at $DIR/control-flow-simplification.rs:14:5: 14:6
|
||||||
return; // scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2
|
return; // scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ fn hello() -> () {
|
||||||
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14
|
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
|
_0 = const (); // scope 0 at $DIR/control-flow-simplification.rs:14:6: 14:6
|
||||||
return; // scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2
|
return; // scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:21:5: 21:12
|
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:21:5: 21:12
|
||||||
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:21:10: 21:11
|
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:21:10: 21:11
|
||||||
_3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:21:10: 21:11
|
_3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:21:10: 21:11
|
||||||
|
nop; // scope 1 at $DIR/remove_unneeded_drops.rs:21:5: 21:12
|
||||||
drop(_3) -> [return: bb2, unwind: bb1]; // scope 1 at $DIR/remove_unneeded_drops.rs:21:5: 21:12
|
drop(_3) -> [return: bb2, unwind: bb1]; // scope 1 at $DIR/remove_unneeded_drops.rs:21:5: 21:12
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:9:5: 9:12
|
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:9:5: 9:12
|
||||||
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:9:10: 9:11
|
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:9:10: 9:11
|
||||||
_3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:9:10: 9:11
|
_3 = move _1; // scope 0 at $DIR/remove_unneeded_drops.rs:9:10: 9:11
|
||||||
|
nop; // scope 1 at $DIR/remove_unneeded_drops.rs:9:5: 9:12
|
||||||
drop(_3) -> [return: bb2, unwind: bb1]; // scope 1 at $DIR/remove_unneeded_drops.rs:9:5: 9:12
|
drop(_3) -> [return: bb2, unwind: bb1]; // scope 1 at $DIR/remove_unneeded_drops.rs:9:5: 9:12
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:4:5: 4:12
|
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:4:5: 4:12
|
||||||
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:4:10: 4:11
|
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:4:10: 4:11
|
||||||
_3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:4:10: 4:11
|
_3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:4:10: 4:11
|
||||||
|
- nop; // scope 1 at $DIR/remove_unneeded_drops.rs:4:5: 4:12
|
||||||
- drop(_3) -> bb1; // scope 1 at $DIR/remove_unneeded_drops.rs:4:5: 4:12
|
- drop(_3) -> bb1; // scope 1 at $DIR/remove_unneeded_drops.rs:4:5: 4:12
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:14:5: 14:12
|
StorageLive(_2); // scope 0 at $DIR/remove_unneeded_drops.rs:14:5: 14:12
|
||||||
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:14:10: 14:11
|
StorageLive(_3); // scope 0 at $DIR/remove_unneeded_drops.rs:14:10: 14:11
|
||||||
_3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:14:10: 14:11
|
_3 = _1; // scope 0 at $DIR/remove_unneeded_drops.rs:14:10: 14:11
|
||||||
|
- nop; // scope 1 at $DIR/remove_unneeded_drops.rs:14:5: 14:12
|
||||||
- drop(_3) -> bb1; // scope 1 at $DIR/remove_unneeded_drops.rs:14:5: 14:12
|
- drop(_3) -> bb1; // scope 1 at $DIR/remove_unneeded_drops.rs:14:5: 14:12
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
let mut _4: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26
|
let mut _4: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26
|
||||||
let mut _5: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20
|
let mut _5: isize; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20
|
||||||
let _6: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19
|
let _6: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19
|
||||||
- let mut _7: bool; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20
|
let mut _7: bool; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20
|
||||||
- let mut _8: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13
|
let mut _8: u8; // in scope 0 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13
|
||||||
scope 1 {
|
scope 1 {
|
||||||
debug a => _6; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19
|
debug a => _6; // in scope 1 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19
|
||||||
}
|
}
|
||||||
|
@ -26,32 +26,51 @@
|
||||||
StorageDead(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69
|
StorageDead(_3); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69
|
||||||
StorageDead(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69
|
StorageDead(_2); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:68: 4:69
|
||||||
_5 = discriminant((_1.0: std::option::Option<u8>)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20
|
_5 = discriminant((_1.0: std::option::Option<u8>)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20
|
||||||
switchInt(move _5) -> [1_isize: bb1, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20
|
switchInt(move _5) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:13: 4:20
|
||||||
}
|
}
|
||||||
|
|
||||||
bb1: {
|
bb1: {
|
||||||
_4 = discriminant((_1.1: std::option::Option<T>)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26
|
_0 = const (); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:6: 8:6
|
||||||
switchInt(move _4) -> [0_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26
|
goto -> bb7; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6
|
||||||
}
|
}
|
||||||
|
|
||||||
bb2: {
|
bb2: {
|
||||||
StorageLive(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19
|
_4 = discriminant((_1.1: std::option::Option<T>)); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26
|
||||||
_6 = (((_1.0: std::option::Option<u8>) as Some).0: u8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19
|
switchInt(move _4) -> [0_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:22: 4:26
|
||||||
- StorageLive(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20
|
|
||||||
- StorageLive(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13
|
|
||||||
- _8 = _6; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13
|
|
||||||
- _7 = Gt(move _8, const 42_u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20
|
|
||||||
- StorageDead(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20
|
|
||||||
- StorageDead(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10
|
|
||||||
StorageDead(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:5: 8:6
|
|
||||||
goto -> bb3; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bb3: {
|
bb3: {
|
||||||
drop(_1) -> bb4; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:9:1: 9:2
|
StorageLive(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19
|
||||||
|
_6 = (((_1.0: std::option::Option<u8>) as Some).0: u8); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:18: 4:19
|
||||||
|
StorageLive(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20
|
||||||
|
StorageLive(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13
|
||||||
|
_8 = _6; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:13
|
||||||
|
_7 = Gt(move _8, const 42_u8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:12: 5:20
|
||||||
|
StorageDead(_8); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:19: 5:20
|
||||||
|
switchInt(move _7) -> [false: bb5, otherwise: bb4]; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:9: 7:10
|
||||||
}
|
}
|
||||||
|
|
||||||
bb4: {
|
bb4: {
|
||||||
|
_0 = const (); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:21: 7:10
|
||||||
|
goto -> bb6; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:9: 7:10
|
||||||
|
}
|
||||||
|
|
||||||
|
bb5: {
|
||||||
|
_0 = const (); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:7:10: 7:10
|
||||||
|
goto -> bb6; // scope 1 at $DIR/simplify-locals-fixedpoint.rs:5:9: 7:10
|
||||||
|
}
|
||||||
|
|
||||||
|
bb6: {
|
||||||
|
StorageDead(_7); // scope 1 at $DIR/simplify-locals-fixedpoint.rs:7:9: 7:10
|
||||||
|
StorageDead(_6); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:8:5: 8:6
|
||||||
|
goto -> bb7; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:4:5: 8:6
|
||||||
|
}
|
||||||
|
|
||||||
|
bb7: {
|
||||||
|
drop(_1) -> bb8; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:9:1: 9:2
|
||||||
|
}
|
||||||
|
|
||||||
|
bb8: {
|
||||||
StorageDead(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:9:1: 9:2
|
StorageDead(_1); // scope 0 at $DIR/simplify-locals-fixedpoint.rs:9:1: 9:2
|
||||||
return; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:9:2: 9:2
|
return; // scope 0 at $DIR/simplify-locals-fixedpoint.rs:9:2: 9:2
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ fn main() -> () {
|
||||||
}
|
}
|
||||||
|
|
||||||
bb1: {
|
bb1: {
|
||||||
|
_0 = const (); // scope 0 at main.rs:8:11: 10:2
|
||||||
return; // scope 0 at main.rs:10:2: 10:2
|
return; // scope 0 at main.rs:10:2: 10:2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,5 @@ impl PrintName {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = PrintName::VOID;
|
let _ = PrintName::VOID;
|
||||||
//~^ ERROR erroneous constant encountered
|
//~^ ERROR erroneous constant used
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,12 @@ LL | #![warn(const_err)]
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
||||||
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: erroneous constant encountered
|
error[E0080]: erroneous constant used
|
||||||
--> $DIR/panic-assoc-never-type.rs:17:13
|
--> $DIR/panic-assoc-never-type.rs:17:13
|
||||||
|
|
|
|
||||||
LL | let _ = PrintName::VOID;
|
LL | let _ = PrintName::VOID;
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^ referenced constant has errors
|
||||||
|
|
||||||
error: aborting due to previous error; 1 warning emitted
|
error: aborting due to previous error; 1 warning emitted
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -11,5 +11,5 @@ const VOID: ! = panic!();
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = VOID;
|
let _ = VOID;
|
||||||
//~^ ERROR erroneous constant encountered
|
//~^ ERROR erroneous constant used
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,12 @@ LL | #![warn(const_err)]
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
||||||
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: erroneous constant encountered
|
error[E0080]: erroneous constant used
|
||||||
--> $DIR/panic-never-type.rs:13:13
|
--> $DIR/panic-never-type.rs:13:13
|
||||||
|
|
|
|
||||||
LL | let _ = VOID;
|
LL | let _ = VOID;
|
||||||
| ^^^^
|
| ^^^^ referenced constant has errors
|
||||||
|
|
||||||
error: aborting due to previous error; 1 warning emitted
|
error: aborting due to previous error; 1 warning emitted
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0080`.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
error[E0391]: cycle detected when computing layout of `std::option::Option<S>`
|
error[E0391]: cycle detected when computing layout of `S`
|
||||||
|
|
|
|
||||||
= note: ...which requires computing layout of `S`...
|
= note: ...which requires computing layout of `std::option::Option<S>`...
|
||||||
= note: ...which again requires computing layout of `std::option::Option<S>`, completing the cycle
|
= note: ...which again requires computing layout of `S`, completing the cycle
|
||||||
note: cycle used when optimizing MIR for `main`
|
note: cycle used when optimizing MIR for `main`
|
||||||
--> $DIR/issue-26548-recursion-via-normalize.rs:15:1
|
--> $DIR/issue-26548-recursion-via-normalize.rs:15:1
|
||||||
|
|
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue