https://github.com/aobolensk updated https://github.com/llvm/llvm-project/pull/239184
>From 3e92e88cb582d6af38ea35b1af7caf3909a313b5 Mon Sep 17 00:00:00 2001 From: Arseniy Obolenskiy <[email protected]> Date: Thu, 5 Nov 2026 12:08:53 +0100 Subject: [PATCH] [CIR][HIP] Disable sanitizers for CUDA/HIP compiler-generated globals Match classic CodeGen ASan padding would break the fatbin wrapper section layout --- .../CIR/Dialect/Builder/CIRBaseBuilder.h | 11 ++++++ .../include/clang/CIR/Dialect/IR/CIRAttrs.td | 35 ++++++++++++++++++- .../clang/CIR/Dialect/IR/CIRDialect.td | 1 + clang/include/clang/CIR/Dialect/IR/CIROps.td | 7 +++- clang/lib/CIR/CodeGen/CIRGenModule.cpp | 6 ++++ .../Dialect/Transforms/LoweringPrepare.cpp | 1 + .../Transforms/TargetLowering/LowerModule.cpp | 6 ++++ .../CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp | 5 +++ .../Lowering/DirectToLLVM/LowerToLLVMIR.cpp | 21 +++++++++++ .../CIR/CodeGen/lowering-lang-options.cpp | 11 ++++++ clang/test/CIR/CodeGenCUDA/device-stub.cu | 19 ++++++++++ clang/test/CIR/CodeGenHIP/hip-cuid.hip | 18 ++++++++++ clang/test/CIR/IR/global.cir | 2 ++ clang/test/CIR/IR/lowering-lang-options.cir | 6 ++-- .../abi-lowering/amdgpu-kernel-hip-ptr.cir | 4 ++- .../abi-lowering/indirect-aliased.cir | 4 ++- ...wering-prepare-cuda-registration-rerun.cir | 2 +- .../test/CIR/Transforms/lowering-prepare.cir | 3 +- 18 files changed, 154 insertions(+), 8 deletions(-) diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h index 489ed57695d299..9dd129f3aae42a 100644 --- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h +++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h @@ -611,6 +611,17 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { linkage); } + /// Exclude a compiler-generated global from sanitizer instrumentation. + void disableSanitizerForGlobal(cir::GlobalOp gv, + const clang::SanitizerSet &sanitize) { + bool noAddress = sanitize.hasOneOf(clang::SanitizerKind::Address | + clang::SanitizerKind::KernelAddress); + bool noHWAddress = sanitize.has(clang::SanitizerKind::HWAddress); + if (noAddress || noHWAddress) + gv.setSanitizerMetadataAttr(cir::SanitizerMetadataAttr::get( + getContext(), noAddress, noHWAddress)); + } + cir::GetMemberOp createGetMember(mlir::Location loc, mlir::Type resultTy, mlir::Value base, llvm::StringRef name, unsigned index) { diff --git a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td index 4be903d337675f..8c7fbd53ea310e 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td +++ b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td @@ -2440,6 +2440,30 @@ def CIR_DynamicInitGuardAttr : CIR_Attr<"DynamicInitGuard", let canHaveIllegalCXXABIType = 0; } +//===----------------------------------------------------------------------===// +// SanitizerMetadataAttr +//===----------------------------------------------------------------------===// + +def CIR_SanitizerMetadataAttr : CIR_Attr<"SanitizerMetadata", + "sanitizer_metadata"> { + let summary = "Sanitizer instrumentation settings for a global variable"; + let description = [{ + Mirrors `llvm::GlobalValue::SanitizerMetadata`. `no_address` and + `no_hw_address` exclude the global from AddressSanitizer and + HWAddressSanitizer instrumentation respectively. + + Example: + ``` + cir.global external @g = #cir.int<0> : !s32i + sanitizer_metadata<no_address = true> + ``` + }]; + let parameters = (ins DefaultValuedParameter<"bool", "false">:$no_address, + DefaultValuedParameter<"bool", "false">:$no_hw_address); + let assemblyFormat = "`<` struct(params) `>`"; + let canHaveIllegalCXXABIType = 0; +} + //===----------------------------------------------------------------------===// // ThreadLocalGlobalWrapperInitAttr //===----------------------------------------------------------------------===// @@ -2687,6 +2711,8 @@ def CIR_LoweringOptionsAttr `ClangABI` gains an enumerator every Clang release (see `clang/Basic/ABIVersions.def`), and the ordinal round-trips fine within a single toolchain. + `sanitize_address`, `sanitize_kernel_address` and `sanitize_hwaddress` + mirror the like-named bits of `LangOptions::Sanitize`. The following fields come from `CodeGenOptions`. `enable_noundef_attrs` mirrors `CodeGenOptions::EnableNoundefAttrs`, @@ -2699,6 +2725,8 @@ def CIR_LoweringOptionsAttr exceptions = false, threadsafe_statics = true, cuda = false, cuda_is_device = false, hip = false, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 17, + long_double_size = 0, sanitize_address = false, + sanitize_kernel_address = false, sanitize_hwaddress = false, enable_noundef_attrs = false>} { } ``` }]; @@ -2715,13 +2743,18 @@ def CIR_LoweringOptionsAttr "bool":$openmp_is_target_device, "int32_t":$clang_abi_compat, "int32_t":$long_double_size, + "bool":$sanitize_address, + "bool":$sanitize_kernel_address, + "bool":$sanitize_hwaddress, "bool":$enable_noundef_attrs ); let assemblyFormat = [{ `<` struct($exceptions, $threadsafe_statics, $cuda, $cuda_is_device, $hip, $hlsl, $gpu_rdc, $openmp, $openmp_is_target_device, - $clang_abi_compat, $long_double_size, $enable_noundef_attrs) `>` + $clang_abi_compat, $long_double_size, $sanitize_address, + $sanitize_kernel_address, $sanitize_hwaddress, + $enable_noundef_attrs) `>` }]; let canHaveIllegalCXXABIType = 0; diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td index 54d7370a7990fa..872124f955e1eb 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td +++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td @@ -71,6 +71,7 @@ def CIR_Dialect : Dialect { static llvm::StringRef getWillReturnAttrName() { return "willreturn"; } static llvm::StringRef getModuleLevelAsmAttrName() { return "cir.module_asm"; } static llvm::StringRef getModuleFramePointerAttrName() { return "cir.frame_pointer"; } + static llvm::StringRef getSanitizerMetadataAttrName() { return "cir.sanitizer_metadata"; } static llvm::StringRef getGlobalCtorsAttrName() { return "cir.global_ctors"; } static llvm::StringRef getGlobalDtorsAttrName() { return "cir.global_dtors"; } static llvm::StringRef getOffloadContainerAttrName() { return "cir.offload.container"; } diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td index 4ffde906be3937..adce59a4fd6a33 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIROps.td +++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td @@ -3502,6 +3502,9 @@ def CIR_GlobalOp : CIR_RegionBranchOpBase<"global", [ LoweringPrepare uses it to place the dynamic initializer emitted from `ctorRegion` into a priority-specific `_GLOBAL__I_<priority>` function instead of the default `_GLOBAL__sub_I_*` function. + + The `sanitizer_metadata` attribute controls sanitizer instrumentation of + the global, see `SanitizerMetadataAttr`. }]; // Note that both sym_name and sym_visibility are tied to Symbol trait. @@ -3530,7 +3533,8 @@ def CIR_GlobalOp : CIR_RegionBranchOpBase<"global", [ OptionalAttr<CIR_AnnotationArrayAttr>:$annotations, OptionalAttr<FlatSymbolRefAttr>:$aliasee, UnitAttr:$strictfp, - OptionalAttr<I32Attr>:$init_priority + OptionalAttr<I32Attr>:$init_priority, + OptionalAttr<CIR_SanitizerMetadataAttr>:$sanitizer_metadata ); let regions = (region MaxSizedRegion<1>:$ctorRegion, @@ -3558,6 +3562,7 @@ def CIR_GlobalOp : CIR_RegionBranchOpBase<"global", [ (`section` `(` $section^ `)`)? (`strictfp` $strictfp^)? (`init_priority` `(` $init_priority^ `)`)? + (`sanitizer_metadata` `` $sanitizer_metadata^)? attr-dict }]; diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 4102da145b7c02..f490ff5d4e45ae 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -208,6 +208,11 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext, /*clang_abi_compat=*/ static_cast<int32_t>(langOpts.getClangABICompat()), static_cast<int32_t>(langOpts.LongDoubleSize), + /*sanitize_address=*/langOpts.Sanitize.has(SanitizerKind::Address), + /*sanitize_kernel_address=*/ + langOpts.Sanitize.has(SanitizerKind::KernelAddress), + /*sanitize_hwaddress=*/ + langOpts.Sanitize.has(SanitizerKind::HWAddress), /*enable_noundef_attrs=*/cgo.EnableNoundefAttrs)); if (cgo.OptimizationLevel > 0 || cgo.OptimizeSize > 0) @@ -4158,6 +4163,7 @@ void CIRGenModule::release() { // External linkage requires public visibility mlir::SymbolTable::setSymbolVisibility( gv, mlir::SymbolTable::Visibility::Public); + builder.disableSanitizerForGlobal(gv, langOpts.Sanitize); addCompilerUsedGlobal(gv); } diff --git a/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp b/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp index ffd631b9ead9d1..2fd311cc8761e4 100644 --- a/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp +++ b/clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp @@ -2944,6 +2944,7 @@ void LoweringPreparePass::buildCUDAModuleCtor() { builder, loc, fatbinWrapperName, fatbinWrapperType, /*isConstant=*/true, {}, GlobalLinkageKind::PrivateLinkage); fatbinWrapper.setSection(fatbinSectionName); + builder.disableSanitizerForGlobal(fatbinWrapper, getLangOpts().Sanitize); constexpr unsigned cudaFatMagic = 0x466243b1; constexpr unsigned hipFatMagic = 0x48495046; diff --git a/clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerModule.cpp b/clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerModule.cpp index 76ab330aa95c39..3071a18c8de6a6 100644 --- a/clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerModule.cpp +++ b/clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerModule.cpp @@ -114,6 +114,12 @@ std::unique_ptr<LowerModule> createLowerModule(mlir::ModuleOp module) { langOpts.setClangABICompat(static_cast<clang::LangOptions::ClangABI>( loweringLangOpts.getClangAbiCompat())); langOpts.LongDoubleSize = loweringLangOpts.getLongDoubleSize(); + langOpts.Sanitize.set(clang::SanitizerKind::Address, + loweringLangOpts.getSanitizeAddress()); + langOpts.Sanitize.set(clang::SanitizerKind::KernelAddress, + loweringLangOpts.getSanitizeKernelAddress()); + langOpts.Sanitize.set(clang::SanitizerKind::HWAddress, + loweringLangOpts.getSanitizeHwaddress()); } // Some langopts are still not lowered. assert(!cir::MissingFeatures::lowerModuleLangOpts()); diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp index a48dbd04de84ac..4dbb7c41170f74 100644 --- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp +++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp @@ -3338,6 +3338,11 @@ CIRToLLVMGlobalOpLowering::lowerGlobalAttributes( attributes.push_back(rewriter.getNamedAttr("externally_initialized", rewriter.getUnitAttr())); + if (cir::SanitizerMetadataAttr sanitizerMetadata = + op.getSanitizerMetadataAttr()) + attributes.push_back(rewriter.getNamedAttr( + CIRDialect::getSanitizerMetadataAttrName(), sanitizerMetadata)); + return attributes; } diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVMIR.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVMIR.cpp index 2b80606fea6138..f2e0fed4cff229 100644 --- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVMIR.cpp +++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVMIR.cpp @@ -63,6 +63,9 @@ class CIRDialectLLVMIRTranslationInterface } else if (auto mod = dyn_cast<mlir::ModuleOp>(op)) { if (mlir::failed(amendModule(mod, attribute, moduleTranslation))) return mlir::failure(); + } else if (auto global = dyn_cast<mlir::LLVM::GlobalOp>(op)) { + if (mlir::failed(amendGlobal(global, attribute, moduleTranslation))) + return mlir::failure(); } else if (attribute.getName() == "cir.riscv_nontemporal_domain") { if (mlir::failed(amendRISCVNontemporalDomain(op, instructions, attribute, moduleTranslation))) @@ -221,6 +224,24 @@ class CIRDialectLLVMIRTranslationInterface return mlir::success(); } + + // Translate CIR global variable attributes to LLVM global variable fields. + mlir::LogicalResult + amendGlobal(mlir::LLVM::GlobalOp global, mlir::NamedAttribute attribute, + mlir::LLVM::ModuleTranslation &moduleTranslation) const { + if (attribute.getName() == + cir::CIRDialect::getSanitizerMetadataAttrName()) { + if (auto attr = mlir::dyn_cast<cir::SanitizerMetadataAttr>( + attribute.getValue())) { + llvm::GlobalVariable::SanitizerMetadata metadata; + metadata.NoAddress = attr.getNoAddress(); + metadata.NoHWAddress = attr.getNoHwAddress(); + cast<llvm::GlobalVariable>(moduleTranslation.lookupGlobal(global)) + ->setSanitizerMetadata(metadata); + } + } + return mlir::success(); + } }; void registerCIRDialectTranslation(mlir::DialectRegistry ®istry) { diff --git a/clang/test/CIR/CodeGen/lowering-lang-options.cpp b/clang/test/CIR/CodeGen/lowering-lang-options.cpp index 83e8d8f71aabf8..8f7b1999b2121a 100644 --- a/clang/test/CIR/CodeGen/lowering-lang-options.cpp +++ b/clang/test/CIR/CodeGen/lowering-lang-options.cpp @@ -8,6 +8,9 @@ // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir \ // RUN: -no-enable-noundef-analysis -emit-cir %s -o - \ // RUN: | FileCheck %s --check-prefix=NONOUNDEF +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir \ +// RUN: -fsanitize=address,hwaddress -emit-cir %s -o - \ +// RUN: | FileCheck %s --check-prefix=SAN // CIRGen serializes the LangOptions and CodeGenOptions facts that post-CIRGen // lowering consumes onto the ModuleOp as a #cir.lowering_options attribute, @@ -32,6 +35,9 @@ int x; // PLAIN-SAME: openmp_is_target_device = false // PLAIN-SAME: clang_abi_compat = {{[0-9]+}} // PLAIN-SAME: long_double_size = 0 +// PLAIN-SAME: sanitize_address = false +// PLAIN-SAME: sanitize_kernel_address = false +// PLAIN-SAME: sanitize_hwaddress = false // PLAIN-SAME: enable_noundef_attrs = true> // -fexceptions -fcxx-exceptions flips exceptions. (OpenMP is exercised in the @@ -52,3 +58,8 @@ int x; // NONOUNDEF: cir.lowering_options = #cir.lowering_options< // NONOUNDEF-SAME: exceptions = false // NONOUNDEF-SAME: enable_noundef_attrs = false> + +// SAN: cir.lowering_options = #cir.lowering_options< +// SAN-SAME: sanitize_address = true +// SAN-SAME: sanitize_kernel_address = false +// SAN-SAME: sanitize_hwaddress = true diff --git a/clang/test/CIR/CodeGenCUDA/device-stub.cu b/clang/test/CIR/CodeGenCUDA/device-stub.cu index dde05578b1cb9b..b5f6433073c893 100644 --- a/clang/test/CIR/CodeGenCUDA/device-stub.cu +++ b/clang/test/CIR/CodeGenCUDA/device-stub.cu @@ -50,6 +50,21 @@ // RUN: -fhip-new-launch-api -cuid=123 -o %t.cuid.hip.ll // RUN: FileCheck --input-file=%t.cuid.hip.ll %s --check-prefix=HIP-CUID +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-cir %s -x hip \ +// RUN: -fhip-new-launch-api -fcuda-include-gpubinary %t -fsanitize=address \ +// RUN: -o %t.asan.hip.cir +// RUN: FileCheck --input-file=%t.asan.hip.cir %s --check-prefix=HIP-ASAN-CIR + +// RUN: %clang_cc1 -triple x86_64-linux-gnu -fclangir -emit-llvm %s -x hip \ +// RUN: -fhip-new-launch-api -fcuda-include-gpubinary %t -fsanitize=address \ +// RUN: -o %t.asan.hip-cir.ll +// RUN: FileCheck --input-file=%t.asan.hip-cir.ll %s --check-prefix=HIP-ASAN + +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -x hip \ +// RUN: -fhip-new-launch-api -fcuda-include-gpubinary %t -fsanitize=address \ +// RUN: -o %t.asan.hip.ll +// RUN: FileCheck --input-file=%t.asan.hip.ll %s --check-prefix=HIP-ASAN + #include "Inputs/cuda.h" __global__ void kernelfunc(int i, int j, int k) {} @@ -390,3 +405,7 @@ __device__ _BitInt(36) c; // HIP-CUID-DAG: call i32 @atexit(ptr @__hip_module_dtor) // HIP-CUID-DAG: define internal void @__hip_module_dtor() // HIP-CUID-DAG: store ptr null, ptr @[[HANDLE]] + +// ASan redzones would break the packed .hipFatBinSegment array. +// HIP-ASAN-CIR: cir.global constant cir_private @__hip_fatbin_wrapper = {{.*}} section(".hipFatBinSegment") sanitizer_metadata<no_address = true> +// HIP-ASAN: @__hip_fatbin_wrapper = {{.*}}constant { i32, i32, ptr, ptr } {{.*}}, section ".hipFatBinSegment", no_sanitize_address diff --git a/clang/test/CIR/CodeGenHIP/hip-cuid.hip b/clang/test/CIR/CodeGenHIP/hip-cuid.hip index 663026016a6b59..77ddfd7efe8fed 100644 --- a/clang/test/CIR/CodeGenHIP/hip-cuid.hip +++ b/clang/test/CIR/CodeGenHIP/hip-cuid.hip @@ -13,6 +13,18 @@ // RUN: -fcuda-is-device -emit-llvm %s -o %t.ogcg.ll // RUN: FileCheck --check-prefix=OGCG %s --input-file=%t.ogcg.ll +// RUN: %clang_cc1 -triple=amdgpu-amd-amdhsa -x hip -fclangir \ +// RUN: -fcuda-is-device -fsanitize=address -emit-cir %s -o %t.asan.cir +// RUN: FileCheck --check-prefix=CIR-ASAN %s --input-file=%t.asan.cir + +// RUN: %clang_cc1 -triple=amdgpu-amd-amdhsa -x hip -fclangir \ +// RUN: -fcuda-is-device -fsanitize=address -emit-llvm %s -o %t.asan.ll +// RUN: FileCheck --check-prefix=LLVM-ASAN %s --input-file=%t.asan.ll + +// RUN: %clang_cc1 -triple=amdgpu-amd-amdhsa -x hip \ +// RUN: -fcuda-is-device -fsanitize=address -emit-llvm %s -o %t.asan.ogcg.ll +// RUN: FileCheck --check-prefix=OGCG-ASAN %s --input-file=%t.asan.ogcg.ll + // Test that HIP compiler unit ID global is emitted // CIR: cir.global external target_address_space(1) @__hip_cuid_{{.*}} = #cir.int<0> : !u8i @@ -23,4 +35,10 @@ // OGCG: @__hip_cuid_{{.*}} = addrspace(1) global i8 0 // OGCG: @llvm.compiler.used = {{.*}}@__hip_cuid_ +// CIR-ASAN: cir.global external target_address_space(1) @__hip_cuid_{{.*}} = #cir.int<0> : !u8i sanitizer_metadata<no_address = true> + +// LLVM-ASAN: @__hip_cuid_{{.*}} = addrspace(1) global i8 0, no_sanitize_address + +// OGCG-ASAN: @__hip_cuid_{{.*}} = addrspace(1) global i8 0, no_sanitize_address + __global__ void kernel() {} diff --git a/clang/test/CIR/IR/global.cir b/clang/test/CIR/IR/global.cir index 101081fc846dc2..8bf3353ab000d4 100644 --- a/clang/test/CIR/IR/global.cir +++ b/clang/test/CIR/IR/global.cir @@ -57,6 +57,7 @@ module attributes {cir.triple = "x86_64-unknown-linux-gnu"} { cir.global external @gi_past_end = #cir.global_offset<@gi, 4> : !cir.ptr<!s32i> cir.global external @gi_before = #cir.global_offset<@gi, -4> : !cir.ptr<!s32i> cir.global "private" external @strict_fp : !s32i strictfp + cir.global external @no_sanitize = #cir.int<0> : !s32i sanitizer_metadata<no_address = true, no_hw_address = true> cir.global weak_odr comdat @self_comdat = #cir.int<0> : !s32i cir.global weak_odr comdat("some_other_symbol") @named_comdat = #cir.int<0> : !s32i } @@ -105,5 +106,6 @@ module attributes {cir.triple = "x86_64-unknown-linux-gnu"} { // CHECK: cir.global external @gi_past_end = #cir.global_offset<@gi, 4> : !cir.ptr<!s32i> // CHECK: cir.global external @gi_before = #cir.global_offset<@gi, -4> : !cir.ptr<!s32i> // CHECK: cir.global "private" external @strict_fp : !s32i strictfp +// CHECK: cir.global external @no_sanitize = #cir.int<0> : !s32i sanitizer_metadata<no_address = true, no_hw_address = true> // CHECK: cir.global weak_odr comdat @self_comdat = #cir.int<0> : !s32i // CHECK: cir.global weak_odr comdat("some_other_symbol") @named_comdat = #cir.int<0> : !s32i diff --git a/clang/test/CIR/IR/lowering-lang-options.cir b/clang/test/CIR/IR/lowering-lang-options.cir index dc49d5b4f62c67..1f7e804c437041 100644 --- a/clang/test/CIR/IR/lowering-lang-options.cir +++ b/clang/test/CIR/IR/lowering-lang-options.cir @@ -8,11 +8,13 @@ module attributes {cir.lowering_options = #cir.lowering_options< exceptions = true, threadsafe_statics = false, cuda = true, cuda_is_device = true, hip = true, hlsl = true, gpu_rdc = true, openmp = true, openmp_is_target_device = true, clang_abi_compat = 9, long_double_size = 80, - enable_noundef_attrs = false>} { + sanitize_address = true, sanitize_kernel_address = true, + sanitize_hwaddress = true, enable_noundef_attrs = false>} { } // CHECK: cir.lowering_options = #cir.lowering_options< // CHECK-SAME: exceptions = true, threadsafe_statics = false, cuda = true, // CHECK-SAME: cuda_is_device = true, hip = true, hlsl = true, gpu_rdc = true, openmp = true, // CHECK-SAME: openmp_is_target_device = true, clang_abi_compat = 9, long_double_size = 80, -// CHECK-SAME: enable_noundef_attrs = false> +// CHECK-SAME: sanitize_address = true, sanitize_kernel_address = true, +// CHECK-SAME: sanitize_hwaddress = true, enable_noundef_attrs = false> diff --git a/clang/test/CIR/Transforms/abi-lowering/amdgpu-kernel-hip-ptr.cir b/clang/test/CIR/Transforms/abi-lowering/amdgpu-kernel-hip-ptr.cir index 8e876439135869..16ef937df3a825 100644 --- a/clang/test/CIR/Transforms/abi-lowering/amdgpu-kernel-hip-ptr.cir +++ b/clang/test/CIR/Transforms/abi-lowering/amdgpu-kernel-hip-ptr.cir @@ -14,7 +14,9 @@ module attributes { exceptions = false, threadsafe_statics = true, cuda = true, cuda_is_device = true, hip = true, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 17, - long_double_size = 0, enable_noundef_attrs = true> + long_double_size = 0, sanitize_address = false, + sanitize_kernel_address = false, sanitize_hwaddress = false, + enable_noundef_attrs = true> } { // The kernel casts the incoming global pointer back to generic before the diff --git a/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir b/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir index 49fab72ee123f6..ab91c89e907bc1 100644 --- a/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir +++ b/clang/test/CIR/Transforms/abi-lowering/indirect-aliased.cir @@ -221,7 +221,9 @@ module attributes { exceptions = false, threadsafe_statics = true, cuda = false, cuda_is_device = false, hip = false, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 17, - long_double_size = 0, enable_noundef_attrs = false> + long_double_size = 0, sanitize_address = false, + sanitize_kernel_address = false, sanitize_hwaddress = false, + enable_noundef_attrs = false> } { cir.func private @takes_big_no_noundef(%arg0: !rec_Big) requires_call_conv_lowering diff --git a/clang/test/CIR/Transforms/lowering-prepare-cuda-registration-rerun.cir b/clang/test/CIR/Transforms/lowering-prepare-cuda-registration-rerun.cir index 3b69501d332fc3..c19e83334a7f6a 100644 --- a/clang/test/CIR/Transforms/lowering-prepare-cuda-registration-rerun.cir +++ b/clang/test/CIR/Transforms/lowering-prepare-cuda-registration-rerun.cir @@ -19,7 +19,7 @@ !s32i = !cir.int<s, 32> !u8i = !cir.int<u, 8> -module attributes {cir.lowering_options = #cir.lowering_options<exceptions = false, threadsafe_statics = true, cuda = true, cuda_is_device = false, hip = true, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 16, long_double_size = 0, enable_noundef_attrs = true>, cir.triple = "x86_64-unknown-linux-gnu"} { +module attributes {cir.lowering_options = #cir.lowering_options<exceptions = false, threadsafe_statics = true, cuda = true, cuda_is_device = false, hip = true, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 16, long_double_size = 0, sanitize_address = false, sanitize_kernel_address = false, sanitize_hwaddress = false, enable_noundef_attrs = true>, cir.triple = "x86_64-unknown-linux-gnu"} { cir.global "private" internal dso_local @dv = #cir.undef : !s32i align(4) {cu.var_registration = #cir.cu.var_registration<dv, Variable>} cir.global constant external @_Z1kv = #cir.global_view<@_Z16__device_stub__kv> : !cir.ptr<!cir.func<()>> align(8) cir.func @_Z16__device_stub__kv() attributes {cu.kernel_name = #cir.cu.kernel_name<"_Z1kv">} { diff --git a/clang/test/CIR/Transforms/lowering-prepare.cir b/clang/test/CIR/Transforms/lowering-prepare.cir index 4cf9206e5700f4..dfb2c0bf9ba307 100644 --- a/clang/test/CIR/Transforms/lowering-prepare.cir +++ b/clang/test/CIR/Transforms/lowering-prepare.cir @@ -13,7 +13,8 @@ module attributes { exceptions = false, threadsafe_statics = true, cuda = false, cuda_is_device = false, hip = false, hlsl = false, gpu_rdc = false, openmp = false, openmp_is_target_device = false, clang_abi_compat = 16, long_double_size = 0, - enable_noundef_attrs = true> + sanitize_address = false, sanitize_kernel_address = false, + sanitize_hwaddress = false, enable_noundef_attrs = true> } { cir.global "private" internal dso_local dynamic_init_guard<"_ZGVZ1gvE1x"> @_ZZ1gvE1x = #cir.int<0> : !s32i align(4) dynamic_init_info<local = true, tls = none, is_inline = false, tsk = undeclared> _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
