Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 13 additions & 1 deletion bolt/test/runtime/AArch64/inline-memcpy.s
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -84,6 +84,9 @@
# CHECK-ASM-LABEL: <test_register_move_negative>:
# CHECK-ASM: bl{{.*}}<memcpy

# CHECK-ASM-LABEL: <test_x2_rewrite_negative>:
# CHECK-ASM: bl{{.*}}<memcpy

# Live-in parameter should NOT be inlined (size unknown at compile time)
# CHECK-ASM-LABEL: <test_live_in_negative>:
# CHECK-ASM: bl{{.*}}<memcpy
Expand Down Expand Up @@ -273,6 +276,15 @@ test_register_move_negative:
ret
.size test_register_move_negative, .-test_register_move_negative

.globl test_x2_rewrite_negative
.type test_x2_rewrite_negative,@function
test_x2_rewrite_negative:
mov x2, #8
ldr x2, [sp, #24]
bl memcpy
ret
.size test_x2_rewrite_negative, .-test_x2_rewrite_negative

.globl test_live_in_negative
.type test_live_in_negative,@function
test_live_in_negative:
Expand Down
Loading