Skip to content

Commit be60192

Browse files
committed
[HWASAN] Inline fast pass of instrumentMemAccessOutline
Usually pointer tag will match tag in the shadow, so we can keep inlining this check keeping the rest in outlined part. It imroves performance by about 25%, but increases code size by 30%. Existing outlining reduces performance by 30%, but saves code size by 80%. So we still significantly reduce code size with minimal performance loss. Reviewed By: fmayer Differential Revision: https://reviews.llvm.org/D159172
1 parent fbd00dd commit be60192

File tree

6 files changed

+605
-6
lines changed

6 files changed

+605
-6
lines changed

llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -894,9 +894,8 @@ void HWAddressSanitizer::instrumentMemAccessOutline(Value *Ptr, bool IsWrite,
894894
assert(!UsePageAliases);
895895
const int64_t AccessInfo = getAccessInfo(IsWrite, AccessSizeIndex);
896896

897-
if (InlineFastPath) {
898-
// TODO.
899-
}
897+
if (InlineFastPath)
898+
InsertBefore = insertShadowTagCheck(Ptr, InsertBefore).TagMismatchTerm;
900899

901900
IRBuilder<> IRB(InsertBefore);
902901
Module *M = IRB.GetInsertBlock()->getParent()->getParent();

llvm/test/Instrumentation/HWAddressSanitizer/RISCV/atomic.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
22
; Test basic address sanitizer instrumentation.
33
;
4-
; RUN: opt < %s -passes=hwasan -S | FileCheck %s
4+
; RUN: opt < %s -passes=hwasan -hwasan-inline-fast-path-checks=0 -S | FileCheck %s
55

66
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
77
target triple = "riscv64-unknown-linux"

0 commit comments

Comments
 (0)