[clang] f4d8b87 - [AMDGPU ASAN] Remove reference to asan bitcode library
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 14 08:54:45 PST 2023
Author: Yaxun (Sam) Liu
Date: 2023-02-14T11:52:41-05:00
New Revision: f4d8b8781de9b0efbaf79621ff66c16964bb1df2
URL: https://github.com/llvm/llvm-project/commit/f4d8b8781de9b0efbaf79621ff66c16964bb1df2
DIFF: https://github.com/llvm/llvm-project/commit/f4d8b8781de9b0efbaf79621ff66c16964bb1df2.diff
LOG: [AMDGPU ASAN] Remove reference to asan bitcode library
The asan functions are now attributed as used
in the device library, no need to keep the
declaration of asan device preserve function.
Patch by: Praveen Velliengiri
Reviewed by: Yaxun Liu
Differential Revision: https://reviews.llvm.org/D143495
Added:
Modified:
clang/lib/CodeGen/CodeGenModule.cpp
Removed:
clang/test/CodeGenCUDA/amdgpu-asan.cu
################################################################################
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 71a2f61ea955f..90c9df4ea4423 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -580,20 +580,6 @@ void CodeGenModule::Release() {
EmitMainVoidAlias();
if (getTriple().isAMDGPU()) {
- // Emit reference of __amdgpu_device_library_preserve_asan_functions to
- // preserve ASAN functions in bitcode libraries.
- if (LangOpts.Sanitize.has(SanitizerKind::Address)) {
- auto *FT = llvm::FunctionType::get(VoidTy, {});
- auto *F = llvm::Function::Create(
- FT, llvm::GlobalValue::ExternalLinkage,
- "__amdgpu_device_library_preserve_asan_functions", &getModule());
- auto *Var = new llvm::GlobalVariable(
- getModule(), FT->getPointerTo(),
- /*isConstant=*/true, llvm::GlobalValue::WeakAnyLinkage, F,
- "__amdgpu_device_library_preserve_asan_functions_ptr", nullptr,
- llvm::GlobalVariable::NotThreadLocal);
- addCompilerUsedGlobal(Var);
- }
// Emit amdgpu_code_object_version module flag, which is code object version
// times 100.
if (getTarget().getTargetOpts().CodeObjectVersion !=
diff --git a/clang/test/CodeGenCUDA/amdgpu-asan.cu b/clang/test/CodeGenCUDA/amdgpu-asan.cu
deleted file mode 100644
index 9c505fe2346ba..0000000000000
--- a/clang/test/CodeGenCUDA/amdgpu-asan.cu
+++ /dev/null
@@ -1,31 +0,0 @@
-// Create a sample address sanitizer bitcode library.
-
-// RUN: %clang_cc1 -x ir -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm-bc \
-// RUN: -disable-llvm-passes -o %t.asanrtl.bc %S/Inputs/amdgpu-asanrtl.ll
-
-// Check sanitizer runtime library functions survive
-// optimizations without being removed or parameters altered.
-
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
-// RUN: -fcuda-is-device -target-cpu gfx906 -fsanitize=address \
-// RUN: -mlink-bitcode-file %t.asanrtl.bc -x hip \
-// RUN: | FileCheck -check-prefixes=ASAN %s
-
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
-// RUN: -fcuda-is-device -target-cpu gfx906 -fsanitize=address \
-// RUN: -O3 -mlink-bitcode-file %t.asanrtl.bc -x hip \
-// RUN: | FileCheck -check-prefixes=ASAN %s
-
-// RUN: %clang_cc1 %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
-// RUN: -fcuda-is-device -target-cpu gfx906 -x hip \
-// RUN: | FileCheck %s
-
-// REQUIRES: amdgpu-registered-target
-
-// ASAN-DAG: define weak void @__amdgpu_device_library_preserve_asan_functions()
-// ASAN-DAG: @__amdgpu_device_library_preserve_asan_functions_ptr = weak addrspace(1) constant ptr @__amdgpu_device_library_preserve_asan_functions
-// ASAN-DAG: @llvm.compiler.used = {{.*}}@__amdgpu_device_library_preserve_asan_functions_ptr
-// ASAN-DAG: define weak void @__asan_report_load1(i64 %{{.*}})
-
-// CHECK-NOT: @__amdgpu_device_library_preserve_asan_functions
-// CHECK-NOT: @__asan_report_load1
More information about the cfe-commits
mailing list