[PATCH] D110468: [AMDGPU] Do not internalize ASan device library functions.

praveen velliengiri via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 27 01:00:48 PDT 2021


pvellien added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp:520
   if (const Function *F = dyn_cast<Function>(&GV))
-    return F->isDeclaration() || AMDGPU::isEntryFunctionCC(F->getCallingConv());
+    return F->isDeclaration() || F->getName().startswith("__asan_") ||
+           AMDGPU::isEntryFunctionCC(F->getCallingConv());
----------------
there are two asan device functions that don't start with "__asan_*" prefix,  they are the following:
1. __sanitizer_ptr_cmp
2. __sanitizer_ptr_sub
@b-sumner do we want to not internalize those functions? 


================
Comment at: llvm/test/CodeGen/AMDGPU/internalize.ll:3
 ; RUN: opt -passes='default<O0>' -S -mtriple=amdgcn-unknown-amdhsa -amdgpu-internalize-symbols < %s | FileCheck -check-prefix=ALL -check-prefix=OPTNONE %s
-; RUN: opt -O1 -S -mtriple=amdgcn-unknown-amdhsa -amdgpu-internalize-symbols < %s | FileCheck -check-prefix=ALL -check-prefix=OPT %s
-; RUN: opt -passes='default<O1>' -S -mtriple=amdgcn-unknown-amdhsa -amdgpu-internalize-symbols < %s | FileCheck -check-prefix=ALL -check-prefix=OPT %s
+; RUN: opt -O1 -S -mtriple=amdgcn-unknown-amdhsa -amdgpu-internalize-symbols < %s | FileCheck -check-prefix=ALL -check-prefix=OPT -check-prefix=ASAN_NO_INTERNALIZE %s
+; RUN: opt -passes='default<O1>' -S -mtriple=amdgcn-unknown-amdhsa -amdgpu-internalize-symbols < %s | FileCheck -check-prefix=ALL -check-prefix=OPT -check-prefix=ASAN_NO_INTERNALIZE %s
----------------
Since, this is a asan related change, I think it would be beneficial if we have a lit test with -fgpu-sanitize option. 
Eg : https://reviews.llvm.org/D99071
please correct me if it is not needed here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110468



More information about the llvm-commits mailing list