[llvm] 2a4f1f4 - Document FP relative offsets (#91031)

via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 12:23:03 PDT 2024


Author: Florian Mayer
Date: 2024-05-07T12:23:00-07:00
New Revision: 2a4f1f4a8ff60d55da69b4654360cf947b5b20f7

URL: https://github.com/llvm/llvm-project/commit/2a4f1f4a8ff60d55da69b4654360cf947b5b20f7
DIFF: https://github.com/llvm/llvm-project/commit/2a4f1f4a8ff60d55da69b4654360cf947b5b20f7.diff

LOG: Document FP relative offsets (#91031)

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Removed: 
    


################################################################################
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