[llvm] [BOLT][AArch64] Enabling Inlining for Memcpy for AArch64 in BOLT (PR #154929)

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 22 07:53:51 PDT 2025


================
@@ -1866,8 +1866,32 @@ Error InlineMemcpy::runOnFunctions(BinaryContext &BC) {
         const bool IsMemcpy8 = (CalleeSymbol->getName() == "_memcpy8");
         const bool IsTailCall = BC.MIB->isTailCall(Inst);
 
+        // Extract the size of thecopy from preceding instructions by looking
+        // for writes to the size register
+        std::optional<uint64_t> KnownSize = std::nullopt;
+        BitVector WrittenRegs(BC.MRI->getNumRegs());
+
+        // Get the size register (3rd arg register, index 2 for AArch64)
----------------
sjoerdmeijer wrote:

Isn't this pretty AArch64 specific, as mentioned in this comment? In other words, does this need to be guarded by a `isAArch64()` check? Maybe I am missing, because if this is running also for X86, I was probably suspecting some test failures.

My the comments could be a bit crisper what we want to match here:

     MOV x2, #nb-bytes
     bl memcopy src, dest, x2

or something along those lines. 



https://github.com/llvm/llvm-project/pull/154929


More information about the llvm-commits mailing list