diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2021-07-04 18:53:04 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-07-09 22:14:44 +0200 |
| commit | 4560efe46c476cf794fa0ce4efb8db5aa55a3351 (patch) | |
| tree | 945df75cbe56cff80f8e3f0e931a00dc7ce73ae1 /compiler/rustc_codegen_ssa/src/mir/operand.rs | |
| parent | 33e9a6b565ddd7f20a5fd3f455eb2f3109d41801 (diff) | |
| download | rust-4560efe46c476cf794fa0ce4efb8db5aa55a3351.tar.gz rust-4560efe46c476cf794fa0ce4efb8db5aa55a3351.zip | |
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.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/mir/operand.rs')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/operand.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs index 25e84c38ed3..3481b36bcc0 100644 --- a/compiler/rustc_codegen_ssa/src/mir/operand.rs +++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs @@ -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(_), _) => { |
