[PATCH] D99071: [ASAN][AMDGPU] Add support for accesses to global and constant addrspaces

Reshabh Sharma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 07:17:34 PDT 2021


rksharma marked an inline comment as done.
rksharma added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1703-1711
+  if (TargetTriple.isAMDGPU()) {
+    Type *PtrTy = cast<PointerType>(Addr->getType()->getScalarType());
+    unsigned int AddrSpace = PtrTy->getPointerAddressSpace();
+    if (AddrSpace == 0)
+      InsertBefore = instrumentAMDGPUGenericAddress(
+          OrigIns, InsertBefore, Addr, TypeSize, IsWrite, SizeArgument);
+    if (AddrSpace == 3 || AddrSpace == 5)
----------------
vitalybuka wrote:
> can you please move more AMD specific code into instrumentAMDGPUGenericAddress?
> 
I tried and moved some more code out of instrumentAddress 


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1882
+      !(TargetTriple.isAMDGPU() &&
+        (G->getAddressSpace() == 1 || G->getAddressSpace() == 4)))
+    return false;
----------------
vitalybuka wrote:
> Can you please extract all these AddressSpace checks into some functions with self explaining names?
> 
> maybe isUnsupportedAmdAddressSpace()
> same for 3,5
I've added one for 3 and 5 which are unsupported


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99071/new/

https://reviews.llvm.org/D99071



More information about the llvm-commits mailing list