[compiler-rt] 9ddb215 - [asan] Remove unnecessary spill in optimized callbacks
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 23 17:00:10 PDT 2023
Author: Vitaly Buka
Date: 2023-08-23T16:59:57-07:00
New Revision: 9ddb2157e3c04a601d7d9764f99f4df3c2fa80c2
URL: https://github.com/llvm/llvm-project/commit/9ddb2157e3c04a601d7d9764f99f4df3c2fa80c2
DIFF: https://github.com/llvm/llvm-project/commit/9ddb2157e3c04a601d7d9764f99f4df3c2fa80c2.diff
LOG: [asan] Remove unnecessary spill in optimized callbacks
We can use r11 scratch registers for calculations.
It does not result in any performance improvements, as the spill is on
the slow path of partial granules.
See X86AsmPrinter::LowerASAN_CHECK_MEMACCESS for callers.
Reviewed By: kstoimenov
Differential Revision: https://reviews.llvm.org/D158525
Added:
Modified:
compiler-rt/lib/asan/asan_rtl_x86_64.S
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_rtl_x86_64.S b/compiler-rt/lib/asan/asan_rtl_x86_64.S
index d93b5ed2a7fe34..0b7363018f425f 100644
--- a/compiler-rt/lib/asan/asan_rtl_x86_64.S
+++ b/compiler-rt/lib/asan/asan_rtl_x86_64.S
@@ -35,35 +35,29 @@ RLABEL(reg, op, s, add): ;\
#define ASAN_MEMORY_ACCESS_EXTRA_CHECK_1(reg, op, i) \
CLABEL(reg, op, 1, i): ;\
- push %rcx ;\
- mov %##reg,%rcx ;\
- and $0x7,%ecx ;\
- cmp %r10d,%ecx ;\
- pop %rcx ;\
+ mov %##reg,%r11 ;\
+ and $0x7,%r11d ;\
+ cmp %r10d,%r11d ;\
jl RLABEL(reg, op, 1, i);\
mov %##reg,%rdi ;\
jmp __asan_report_##op##1_asm ;\
#define ASAN_MEMORY_ACCESS_EXTRA_CHECK_2(reg, op, i) \
CLABEL(reg, op, 2, i): ;\
- push %rcx ;\
- mov %##reg,%rcx ;\
- and $0x7,%ecx ;\
- add $0x1,%ecx ;\
- cmp %r10d,%ecx ;\
- pop %rcx ;\
+ mov %##reg,%r11 ;\
+ and $0x7,%r11d ;\
+ add $0x1,%r11d ;\
+ cmp %r10d,%r11d ;\
jl RLABEL(reg, op, 2, i);\
mov %##reg,%rdi ;\
jmp __asan_report_##op##2_asm ;\
#define ASAN_MEMORY_ACCESS_EXTRA_CHECK_4(reg, op, i) \
CLABEL(reg, op, 4, i): ;\
- push %rcx ;\
- mov %##reg,%rcx ;\
- and $0x7,%ecx ;\
- add $0x3,%ecx ;\
- cmp %r10d,%ecx ;\
- pop %rcx ;\
+ mov %##reg,%r11 ;\
+ and $0x7,%r11d ;\
+ add $0x3,%r11d ;\
+ cmp %r10d,%r11d ;\
jl RLABEL(reg, op, 4, i);\
mov %##reg,%rdi ;\
jmp __asan_report_##op##4_asm ;\
More information about the llvm-commits
mailing list