提交 2ce1adde 编写于 作者: N Nikita Popov

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.
上级 208173f8
......@@ -291,11 +291,10 @@ fn store_with_flags<Bx: BuilderMethods<'a, 'tcx, Value = 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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册