@@ -12,7 +12,7 @@ use crate::common::{
12
12
AtomicOrdering , AtomicRmwBinOp , IntPredicate , RealPredicate , SynchronizationScope , TypeKind ,
13
13
} ;
14
14
use crate :: mir:: operand:: { OperandRef , OperandValue } ;
15
- use crate :: mir:: place:: PlaceRef ;
15
+ use crate :: mir:: place:: { PlaceRef , PlaceValue } ;
16
16
use crate :: MemFlags ;
17
17
18
18
use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrs ;
@@ -156,6 +156,10 @@ pub trait BuilderMethods<'a, 'tcx>:
156
156
order : AtomicOrdering ,
157
157
size : Size ,
158
158
) -> 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
+ }
159
163
fn load_operand ( & mut self , place : PlaceRef < ' tcx , Self :: Value > )
160
164
-> OperandRef < ' tcx , Self :: Value > ;
161
165
@@ -171,6 +175,10 @@ pub trait BuilderMethods<'a, 'tcx>:
171
175
fn nonnull_metadata ( & mut self , load : Self :: Value ) ;
172
176
173
177
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
+ }
174
182
fn store_with_flags (
175
183
& mut self ,
176
184
val : Self :: Value ,
@@ -296,7 +304,7 @@ pub trait BuilderMethods<'a, 'tcx>:
296
304
if flags. contains ( MemFlags :: NONTEMPORAL ) {
297
305
// HACK(nox): This is inefficient but there is no nontemporal memcpy.
298
306
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 ) ;
300
308
self . store_with_flags ( val, dst. val . llval , dst. val . align , flags) ;
301
309
} else if self . sess ( ) . opts . optimize == OptLevel :: No && self . is_backend_immediate ( dst. layout )
302
310
{
0 commit comments