Pass type when creating load

This makes load generation compatible with opaque pointers.

The generation of nontemporal copies still accesses the pointer
element type, as fixing this requires more movement.
This commit is contained in:
Nikita Popov
2021-07-04 18:53:04 +02:00
parent 33e9a6b565
commit 4560efe46c
10 changed files with 65 additions and 52 deletions

View File

@@ -289,6 +289,15 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue<V> {
}
match self {
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);
return;
}
base::memcpy_ty(bx, dest.llval, dest.align, r, source_align, dest.layout, flags)
}
OperandValue::Ref(_, Some(_), _) => {