@@ -30,7 +30,7 @@ use crate::interpret::{
30
30
self , InterpCx , ScalarMaybeUndef , Immediate , OpTy ,
31
31
StackPopCleanup , LocalValue , LocalState , AllocId , Frame ,
32
32
Allocation , MemoryKind , ImmTy , Pointer , Memory , PlaceTy ,
33
- Operand as InterpOperand ,
33
+ Operand as InterpOperand , intern_const_alloc_recursive ,
34
34
} ;
35
35
use crate :: const_eval:: error_to_const_error;
36
36
use crate :: transform:: { MirPass , MirSource } ;
@@ -655,14 +655,27 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
655
655
return false ;
656
656
}
657
657
658
- match * op {
658
+ let is_scalar = match * op {
659
659
interpret:: Operand :: Immediate ( Immediate :: Scalar ( ScalarMaybeUndef :: Scalar ( s) ) ) =>
660
660
s. is_bits ( ) ,
661
661
interpret:: Operand :: Immediate ( Immediate :: ScalarPair ( ScalarMaybeUndef :: Scalar ( l) ,
662
662
ScalarMaybeUndef :: Scalar ( r) ) ) =>
663
663
l. is_bits ( ) && r. is_bits ( ) ,
664
664
_ => false
665
+ } ;
666
+
667
+ if let interpret:: Operand :: Indirect ( _) = * op {
668
+ if self . tcx . sess . opts . debugging_opts . mir_opt_level >= 2 {
669
+ intern_const_alloc_recursive (
670
+ & mut self . ecx ,
671
+ None ,
672
+ op. assert_mem_place ( )
673
+ ) . expect ( "failed to intern alloc" ) ;
674
+ return true ;
675
+ }
665
676
}
677
+
678
+ return is_scalar;
666
679
}
667
680
}
668
681
0 commit comments