[PATCH] D137013: [asan] Use proper shadow offset for loongarch64 in instrumentation passes
Youling Tang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 31 21:56:53 PDT 2022
tangyouling updated this revision to Diff 472208.
tangyouling added a comment.
"necessary" --> "necessarily".
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137013/new/
https://reviews.llvm.org/D137013
Files:
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Index: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -106,6 +106,7 @@
static const uint64_t kMIPS32_ShadowOffset32 = 0x0aaa0000;
static const uint64_t kMIPS64_ShadowOffset64 = 1ULL << 37;
static const uint64_t kAArch64_ShadowOffset64 = 1ULL << 36;
+static const uint64_t kLoongArch64_ShadowOffset64 = 1ULL << 46;
static const uint64_t kRISCV64_ShadowOffset64 = 0xd55550000;
static const uint64_t kFreeBSD_ShadowOffset32 = 1ULL << 30;
static const uint64_t kFreeBSD_ShadowOffset64 = 1ULL << 46;
@@ -484,6 +485,7 @@
bool IsMIPS64 = TargetTriple.isMIPS64();
bool IsArmOrThumb = TargetTriple.isARM() || TargetTriple.isThumb();
bool IsAArch64 = TargetTriple.getArch() == Triple::aarch64;
+ bool IsLoongArch64 = TargetTriple.getArch() == Triple::loongarch64;
bool IsRISCV64 = TargetTriple.getArch() == Triple::riscv64;
bool IsWindows = TargetTriple.isOSWindows();
bool IsFuchsia = TargetTriple.isOSFuchsia();
@@ -555,6 +557,8 @@
Mapping.Offset = kDynamicShadowSentinel;
else if (IsAArch64)
Mapping.Offset = kAArch64_ShadowOffset64;
+ else if (IsLoongArch64)
+ Mapping.Offset = kLoongArch64_ShadowOffset64;
else if (IsRISCV64)
Mapping.Offset = kRISCV64_ShadowOffset64;
else if (IsAMDGPU)
@@ -573,12 +577,12 @@
}
// OR-ing shadow offset if more efficient (at least on x86) if the offset
- // is a power of two, but on ppc64 we have to use add since the shadow
- // offset is not necessary 1/8-th of the address space. On SystemZ,
- // we could OR the constant in a single instruction, but it's more
+ // is a power of two, but on ppc64 and loongarch64 we have to use add since
+ // the shadow offset is not necessarily 1/8-th of the address space. On
+ // SystemZ, we could OR the constant in a single instruction, but it's more
// efficient to load it once and use indexed addressing.
Mapping.OrShadowOffset = !IsAArch64 && !IsPPC64 && !IsSystemZ && !IsPS &&
- !IsRISCV64 &&
+ !IsRISCV64 && !IsLoongArch64 &&
!(Mapping.Offset & (Mapping.Offset - 1)) &&
Mapping.Offset != kDynamicShadowSentinel;
bool IsAndroidWithIfuncSupport =
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137013.472208.patch
Type: text/x-patch
Size: 2427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221101/4fe7cfb4/attachment.bin>
More information about the llvm-commits
mailing list