diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-04-03 22:07:44 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-04-09 08:51:33 -0700 |
| commit | c6dde9d8a786186877bea8ed0b22d61476d76851 (patch) | |
| tree | 75cf2bec7a956c884ce0aaec12f2125ea68d6825 /compiler/rustc_codegen_ssa/src | |
| parent | b5376ba6017fa04a13afda6ac52587f06a6c0bd8 (diff) | |
| download | rust-c6dde9d8a786186877bea8ed0b22d61476d76851.tar.gz rust-c6dde9d8a786186877bea8ed0b22d61476d76851.zip | |
Put the `NONTEMPORAL` case first
That's how it was in `store_with_flags` before this PR, so let's do that here too just to be sure we get the right thing.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/traits/builder.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs index c9d40b7c724..c0281e75d9d 100644 --- a/compiler/rustc_codegen_ssa/src/traits/builder.rs +++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs @@ -293,16 +293,17 @@ pub trait BuilderMethods<'a, 'tcx>: debug_assert!(src.llextra.is_none(), "cannot directly copy from unsized values"); debug_assert!(dst.llextra.is_none(), "cannot directly copy into unsized values"); debug_assert_eq!(dst.layout.size, src.layout.size); - if self.sess().opts.optimize == OptLevel::No && self.is_backend_immediate(dst.layout) { - // If we're not optimizing, the aliasing information from `memcpy` - // isn't useful, so just load-store the value for smaller code. - let temp = self.load_operand(src); - temp.val.store_with_flags(self, dst, flags); - } else if flags.contains(MemFlags::NONTEMPORAL) { + if flags.contains(MemFlags::NONTEMPORAL) { // HACK(nox): This is inefficient but there is no nontemporal memcpy. let ty = self.backend_type(dst.layout); let val = self.load(ty, src.llval, src.align); self.store_with_flags(val, dst.llval, dst.align, flags); + } else if self.sess().opts.optimize == OptLevel::No && self.is_backend_immediate(dst.layout) + { + // If we're not optimizing, the aliasing information from `memcpy` + // isn't useful, so just load-store the value for smaller code. + let temp = self.load_operand(src); + temp.val.store_with_flags(self, dst, flags); } else if !dst.layout.is_zst() { let bytes = self.const_usize(dst.layout.size.bytes()); self.memcpy(dst.llval, dst.align, src.llval, src.align, bytes, flags); |
