From 2ce1addeba5030eaa5d5dbdf2cc2a9c53a107c06 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 6 Jul 2021 21:55:03 +0200 Subject: 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. --- compiler/rustc_codegen_ssa/src/mir/operand.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'compiler/rustc_codegen_ssa') diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index 3481b36bcc0..3c42b2cc2ea 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -291,11 +291,10 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue { 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) -- cgit 1.4.1-3-g733a5