From 515c97065a5352448747fbaf1f5ea43173a4457a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sat, 18 Jan 2025 12:45:27 +0100 Subject: [PATCH] Revert "work around llvm failing to lower memcpy" This reverts commit acf70439551fc3f49b2d292ff93ee519901cdf42. Fixed as of ec768b7fa2f9c7dea6b92651bef59a7eea3299f2. --- lib/compiler_rt/memcpy.zig | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/lib/compiler_rt/memcpy.zig b/lib/compiler_rt/memcpy.zig index c540e81638b1b9cf943597d08cc15198e443024d..614bcc7182795a8dc581427fe8fef05bc4dcaa67 100644 --- a/lib/compiler_rt/memcpy.zig +++ b/lib/compiler_rt/memcpy.zig @@ -9,36 +9,12 @@ comptime { } } -const llvm_cannot_lower = switch (builtin.cpu.arch) { - .arm, .armeb, .thumb, .thumbeb => builtin.zig_backend == .stage2_llvm, - else => false, -}; - fn memcpy(noalias opt_dest: ?[*]u8, noalias opt_src: ?[*]const u8, len: usize) callconv(.C) ?[*]u8 { - if (llvm_cannot_lower) { - for (0..len) |i| opt_dest.?[i] = opt_src.?[i]; - return opt_dest; - } else { - return memmove(opt_dest, opt_src, len); - } + return memmove(opt_dest, opt_src, len); } -/// A port of https://github.com/facebook/folly/blob/1c8bc50e88804e2a7361a57cd9b551dd10f6c5fd/folly/memcpy.S fn memmove(opt_dest: ?[*]u8, opt_src: ?[*]const u8, len: usize) callconv(.C) ?[*]u8 { - if (llvm_cannot_lower) { - if (@intFromPtr(opt_dest) < @intFromPtr(opt_src)) { - for (0..len) |i| opt_dest.?[i] = opt_src.?[i]; - return opt_dest; - } else { - var index = len; - while (index != 0) { - index -= 1; - opt_dest.?[index] = opt_src.?[index]; - } - return opt_dest; - } - } - + // a port of https://github.com/facebook/folly/blob/1c8bc50e88804e2a7361a57cd9b551dd10f6c5fd/folly/memcpy.S if (len == 0) { @branchHint(.unlikely); return opt_dest; -- 2.54.0