@@ -476,20 +476,23 @@ impl<'tcx> MutVisitor<'tcx> for VnState<'_, 'tcx> {
476
476
}
477
477
478
478
fn visit_statement ( & mut self , stmt : & mut Statement < ' tcx > , location : Location ) {
479
- self . super_statement ( stmt, location) ;
480
479
if let StatementKind :: Assign ( box ( _, ref mut rvalue) ) = stmt. kind
481
480
// Do not try to simplify a constant, it's already in canonical shape.
482
481
&& !matches ! ( rvalue, Rvalue :: Use ( Operand :: Constant ( _) ) )
483
- && let Some ( value) = self . simplify_rvalue ( rvalue, location)
484
482
{
485
- if let Some ( const_) = self . try_as_constant ( value) {
486
- * rvalue = Rvalue :: Use ( Operand :: Constant ( Box :: new ( const_) ) ) ;
487
- } else if let Some ( local) = self . try_as_local ( value, location)
488
- && * rvalue != Rvalue :: Use ( Operand :: Move ( local. into ( ) ) )
483
+ if let Some ( value) = self . simplify_rvalue ( rvalue, location)
489
484
{
490
- * rvalue = Rvalue :: Use ( Operand :: Copy ( local. into ( ) ) ) ;
491
- self . reused_locals . insert ( local) ;
485
+ if let Some ( const_) = self . try_as_constant ( value) {
486
+ * rvalue = Rvalue :: Use ( Operand :: Constant ( Box :: new ( const_) ) ) ;
487
+ } else if let Some ( local) = self . try_as_local ( value, location)
488
+ && * rvalue != Rvalue :: Use ( Operand :: Move ( local. into ( ) ) )
489
+ {
490
+ * rvalue = Rvalue :: Use ( Operand :: Copy ( local. into ( ) ) ) ;
491
+ self . reused_locals . insert ( local) ;
492
+ }
492
493
}
494
+ } else {
495
+ self . super_statement ( stmt, location) ;
493
496
}
494
497
}
495
498
}
0 commit comments