mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
Don't access pointer element type for nontemporal store
Simply shift the bitcast from the store to the load, so that we can use the destination type. I'm not sure the bitcast is really necessary, but keeping it for now.
This commit is contained in:
parent
208173f8e9
commit
2ce1addeba
@ -291,11 +291,10 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> {
|
||||
OperandValue::Ref(r, None, source_align) => {
|
||||
if flags.contains(MemFlags::NONTEMPORAL) {
|
||||
// HACK(nox): This is inefficient but there is no nontemporal memcpy.
|
||||
// FIXME: Don't access pointer element type.
|
||||
let ty = bx.element_type(bx.val_ty(r));
|
||||
let val = bx.load(ty, r, source_align);
|
||||
let ptr = bx.pointercast(dest.llval, bx.type_ptr_to(ty));
|
||||
bx.store_with_flags(val, ptr, dest.align, flags);
|
||||
let ty = bx.backend_type(dest.layout);
|
||||
let ptr = bx.pointercast(r, bx.type_ptr_to(ty));
|
||||
let val = bx.load(ty, ptr, source_align);
|
||||
bx.store_with_flags(val, dest.llval, dest.align, flags);
|
||||
return;
|
||||
}
|
||||
base::memcpy_ty(bx, dest.llval, dest.align, r, source_align, dest.layout, flags)
|
||||
|
Loading…
Reference in New Issue
Block a user