File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
compiler/rustc_mir/src/transform Expand file tree Collapse file tree 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 {
2929 optimization_finder. optimizations
3030 } ;
3131
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+ }
3436 }
3537}
3638
@@ -296,3 +298,12 @@ struct OptimizationList<'tcx> {
296298 unneeded_equality_comparison : FxHashMap < Location , Operand < ' tcx > > ,
297299 unneeded_deref : FxHashMap < Location , Place < ' tcx > > ,
298300}
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