File tree 1 file changed +13
-2
lines changed
compiler/rustc_mir/src/transform
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,10 @@ impl<'tcx> MirPass<'tcx> for InstCombine {
29
29
optimization_finder. optimizations
30
30
} ;
31
31
32
- // Then carry out those optimizations.
33
- MutVisitor :: visit_body ( & mut InstCombineVisitor { optimizations, tcx } , body) ;
32
+ if !optimizations. is_empty ( ) {
33
+ // Then carry out those optimizations.
34
+ MutVisitor :: visit_body ( & mut InstCombineVisitor { optimizations, tcx } , body) ;
35
+ }
34
36
}
35
37
}
36
38
@@ -296,3 +298,12 @@ struct OptimizationList<'tcx> {
296
298
unneeded_equality_comparison : FxHashMap < Location , Operand < ' tcx > > ,
297
299
unneeded_deref : FxHashMap < Location , Place < ' tcx > > ,
298
300
}
301
+
302
+ impl < ' tcx > OptimizationList < ' tcx > {
303
+ fn is_empty ( & self ) -> bool {
304
+ self . and_stars . is_empty ( )
305
+ && self . arrays_lengths . is_empty ( )
306
+ && self . unneeded_equality_comparison . is_empty ( )
307
+ && self . unneeded_deref . is_empty ( )
308
+ }
309
+ }
You can’t perform that action at this time.
0 commit comments