From b8c7e348e1f296564d14f7024e3d40fce6ebb5ed Mon Sep 17 00:00:00 2001 From: Elvina Yakubova Date: Mon, 3 Nov 2025 05:22:02 -0800 Subject: [PATCH] [BOLT] Update search to proceed upwards from memcpy call Search should procced from CallInst to the beginning of BB Patch by Yafet Beyene alulayafet@gmail.com --- bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp | 2 +- bolt/test/runtime/AArch64/inline-memcpy.s | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp b/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp index 6954cb295e86a..c96f3d6a06f39 100644 --- a/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp +++ b/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp @@ -2758,7 +2758,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder { BitVector WrittenRegs(RegInfo->getNumRegs()); const BitVector &SizeRegAliases = getAliases(SizeReg); - for (auto InstIt = BB.begin(); InstIt != CallInst; ++InstIt) { + for (auto InstIt = CallInst; InstIt != BB.begin(); --InstIt) { const MCInst &Inst = *InstIt; WrittenRegs.reset(); getWrittenRegs(Inst, WrittenRegs); diff --git a/bolt/test/runtime/AArch64/inline-memcpy.s b/bolt/test/runtime/AArch64/inline-memcpy.s index dc59a08b889a7..badff299603a0 100644 --- a/bolt/test/runtime/AArch64/inline-memcpy.s +++ b/bolt/test/runtime/AArch64/inline-memcpy.s @@ -7,7 +7,7 @@ # RUN: llvm-bolt %t.exe --inline-memcpy -o %t.bolt 2>&1 | FileCheck %s --check-prefix=CHECK-INLINE # RUN: llvm-objdump -d %t.bolt | FileCheck %s --check-prefix=CHECK-ASM -# Verify BOLT reports that it inlined memcpy calls (11 successful inlines out of 16 total calls) +# Verify BOLT reports that it inlined memcpy calls (11 successful inlines out of 17 total calls) # CHECK-INLINE: BOLT-INFO: inlined 11 memcpy() calls # Each function should use optimal size-specific instructions and NO memcpy calls @@ -84,6 +84,9 @@ # CHECK-ASM-LABEL: : # CHECK-ASM: bl{{.*}}: +# CHECK-ASM: bl{{.*}}: # CHECK-ASM: bl{{.*}}