@@ -7,7 +7,10 @@ use rustc_middle::mir::{Body, Local, UnwindTerminateReason, traversal};
7
7
use rustc_middle:: ty:: layout:: { FnAbiOf , HasTyCtxt , HasTypingEnv , TyAndLayout } ;
8
8
use rustc_middle:: ty:: { self , Instance , Ty , TyCtxt , TypeVisitableExt } ;
9
9
use rustc_middle:: { bug, mir, span_bug} ;
10
- use rustc_mir_transform:: { add_call_guards, dump_mir, pass_manager} ;
10
+ use rustc_mir_transform:: {
11
+ add_call_guards, dump_mir, pass_manager, remove_noop_landing_pads, remove_unneeded_drops,
12
+ remove_zsts, simplify, simplify_branches, unreachable_enum_branching, unreachable_prop,
13
+ } ;
11
14
use rustc_target:: callconv:: { FnAbi , PassMode } ;
12
15
use tracing:: { debug, instrument} ;
13
16
@@ -172,6 +175,15 @@ pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
172
175
cx. tcx ( ) ,
173
176
& mut mir,
174
177
& [
178
+ // Monomorphization may introduce ZST, non-drop and uninhabited types.
179
+ & remove_zsts:: RemoveZsts ,
180
+ & remove_unneeded_drops:: RemoveUnneededDrops ,
181
+ & unreachable_enum_branching:: UnreachableEnumBranching ,
182
+ & unreachable_prop:: UnreachablePropagation ,
183
+ & remove_noop_landing_pads:: RemoveNoopLandingPads ,
184
+ & simplify_branches:: SimplifyConstCondition :: Monomorphic ,
185
+ & simplify:: SimplifyCfg :: Monomorphic ,
186
+ & simplify:: SimplifyLocals :: Monomorphic ,
175
187
// Some cleanup necessary at least for LLVM and potentially other codegen backends.
176
188
& add_call_guards:: CriticalCallEdges ,
177
189
// Dump the end result for testing and debugging purposes.
0 commit comments