@@ -12,7 +12,7 @@ use crate::common::{
1212 AtomicOrdering , AtomicRmwBinOp , IntPredicate , RealPredicate , SynchronizationScope , TypeKind ,
1313} ;
1414use crate :: mir:: operand:: { OperandRef , OperandValue } ;
15- use crate :: mir:: place:: PlaceRef ;
15+ use crate :: mir:: place:: { PlaceRef , PlaceValue } ;
1616use crate :: MemFlags ;
1717
1818use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrs ;
@@ -156,6 +156,10 @@ pub trait BuilderMethods<'a, 'tcx>:
156156 order : AtomicOrdering ,
157157 size : Size ,
158158 ) -> Self :: Value ;
159+ fn load_from_place ( & mut self , ty : Self :: Type , place : PlaceValue < Self :: Value > ) -> Self :: Value {
160+ debug_assert_eq ! ( place. llextra, None ) ;
161+ self . load ( ty, place. llval , place. align )
162+ }
159163 fn load_operand ( & mut self , place : PlaceRef < ' tcx , Self :: Value > )
160164 -> OperandRef < ' tcx , Self :: Value > ;
161165
@@ -171,6 +175,10 @@ pub trait BuilderMethods<'a, 'tcx>:
171175 fn nonnull_metadata ( & mut self , load : Self :: Value ) ;
172176
173177 fn store ( & mut self , val : Self :: Value , ptr : Self :: Value , align : Align ) -> Self :: Value ;
178+ fn store_to_place ( & mut self , val : Self :: Value , place : PlaceValue < Self :: Value > ) -> Self :: Value {
179+ debug_assert_eq ! ( place. llextra, None ) ;
180+ self . store ( val, place. llval , place. align )
181+ }
174182 fn store_with_flags (
175183 & mut self ,
176184 val : Self :: Value ,
@@ -296,7 +304,7 @@ pub trait BuilderMethods<'a, 'tcx>:
296304 if flags. contains ( MemFlags :: NONTEMPORAL ) {
297305 // HACK(nox): This is inefficient but there is no nontemporal memcpy.
298306 let ty = self . backend_type ( dst. layout ) ;
299- let val = self . load ( ty, src. val . llval , src . val . align ) ;
307+ let val = self . load_from_place ( ty, src. val ) ;
300308 self . store_with_flags ( val, dst. val . llval , dst. val . align , flags) ;
301309 } else if self . sess ( ) . opts . optimize == OptLevel :: No && self . is_backend_immediate ( dst. layout )
302310 {
0 commit comments