Skip to content

Commit c6dde9d

Browse files
committed
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.
1 parent b5376ba commit c6dde9d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

compiler/rustc_codegen_ssa/src/traits/builder.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -293,16 +293,17 @@ pub trait BuilderMethods<'a, 'tcx>:
293293
debug_assert!(src.llextra.is_none(), "cannot directly copy from unsized values");
294294
debug_assert!(dst.llextra.is_none(), "cannot directly copy into unsized values");
295295
debug_assert_eq!(dst.layout.size, src.layout.size);
296-
if self.sess().opts.optimize == OptLevel::No && self.is_backend_immediate(dst.layout) {
297-
// If we're not optimizing, the aliasing information from `memcpy`
298-
// isn't useful, so just load-store the value for smaller code.
299-
let temp = self.load_operand(src);
300-
temp.val.store_with_flags(self, dst, flags);
301-
} else if flags.contains(MemFlags::NONTEMPORAL) {
296+
if flags.contains(MemFlags::NONTEMPORAL) {
302297
// HACK(nox): This is inefficient but there is no nontemporal memcpy.
303298
let ty = self.backend_type(dst.layout);
304299
let val = self.load(ty, src.llval, src.align);
305300
self.store_with_flags(val, dst.llval, dst.align, flags);
301+
} else if self.sess().opts.optimize == OptLevel::No && self.is_backend_immediate(dst.layout)
302+
{
303+
// If we're not optimizing, the aliasing information from `memcpy`
304+
// isn't useful, so just load-store the value for smaller code.
305+
let temp = self.load_operand(src);
306+
temp.val.store_with_flags(self, dst, flags);
306307
} else if !dst.layout.is_zst() {
307308
let bytes = self.const_usize(dst.layout.size.bytes());
308309
self.memcpy(dst.llval, dst.align, src.llval, src.align, bytes, flags);

0 commit comments

Comments
 (0)