1
Fork 0

only run RemoveZsts at mir-opt-level 3 and above

This commit is contained in:
Erik Desjardins 2021-03-22 18:30:56 -04:00
parent 46fd49cdc3
commit 6960bc9696
14 changed files with 56 additions and 26 deletions

View file

@ -8,6 +8,9 @@ pub struct RemoveZsts;
impl<'tcx> MirPass<'tcx> for RemoveZsts {
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 (basic_blocks, local_decls) = body.basic_blocks_and_local_decls_mut();
for block in basic_blocks.iter_mut() {