Author: Yaxun (Sam) Liu Date: 2025-05-27T16:58:04-04:00 New Revision: c720f920094e445af23ce8e214813f57694ab716
URL: https://github.com/llvm/llvm-project/commit/c720f920094e445af23ce8e214813f57694ab716 DIFF: https://github.com/llvm/llvm-project/commit/c720f920094e445af23ce8e214813f57694ab716.diff LOG: [HIP] disable sanitizer for `__hip_cuid` (#141581) Global variable `__hip_cuid_*` is for identifying purpose and does not need sanitization, therefore disable it for sanitizers. Added: clang/test/CodeGenCUDA/nosanitize-cuid.hip Modified: clang/lib/CodeGen/CodeGenModule.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 16e010adbeb5f..039507bc03510 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -971,6 +971,7 @@ void CodeGenModule::Release() { getModule(), Int8Ty, false, llvm::GlobalValue::ExternalLinkage, llvm::Constant::getNullValue(Int8Ty), "__hip_cuid_" + getContext().getCUIDHash()); + getSanitizerMetadata()->disableSanitizerForGlobal(GV); addCompilerUsedGlobal(GV); } emitLLVMUsed(); diff --git a/clang/test/CodeGenCUDA/nosanitize-cuid.hip b/clang/test/CodeGenCUDA/nosanitize-cuid.hip new file mode 100644 index 0000000000000..4af83c91ac883 --- /dev/null +++ b/clang/test/CodeGenCUDA/nosanitize-cuid.hip @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fsanitize=address -fcuda-is-device \ +// RUN: -emit-llvm -cuid=abcd -o - %s | FileCheck %s + +#include "Inputs/cuda.h" + +// CHECK: @__hip_cuid_{{.*}} = {{.*}} no_sanitize_address _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits