[llvm] Document FP relative offsets (PR #91031)
Florian Mayer via llvm-commits
llvm-commits at lists.llvm.org
Fri May 3 16:43:11 PDT 2024
https://github.com/fmayer created https://github.com/llvm/llvm-project/pull/91031
None
>From 68e3acdb3ef1ddf70cd05a7e8f1d0f68cf5d63e3 Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Fri, 3 May 2024 16:42:49 -0700
Subject: [PATCH] Document FP relative offsets
---
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index fa661b17c13a90..fca1824165e7e3 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1271,6 +1271,9 @@ Value *HWAddressSanitizer::getFrameRecordInfo(IRBuilder<> &IRB) {
// FP is 0xfffffffffffFFFF0 (4 lower bits are zero)
// We only really need ~20 lower non-zero bits (FFFF), so we mix like this:
// 0xFFFFPPPPPPPPPPPP
+ //
+ // FP works because in AArch64FrameLowering::getFrameIndexReference, we
+ // prefer FP-relative offsets for functions compiled with HWASan.
FP = IRB.CreateShl(FP, 44);
return IRB.CreateOr(PC, FP);
}
More information about the llvm-commits
mailing list