Skip to content

Commit fba5da6

Browse files
committed
[AMDGPU][ASAN] Remove mdgpu-no-flat-scratch-init attribute from lowered kernels in amdgpu-sw-lower-lds pass
1 parent b4f1e0e commit fba5da6

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,8 @@ bool AMDGPUSwLowerLDS::run() {
12131213
removeFnAttrFromReachable(
12141214
CG, Func,
12151215
{"amdgpu-no-workitem-id-x", "amdgpu-no-workitem-id-y",
1216-
"amdgpu-no-workitem-id-z", "amdgpu-no-heap-ptr"});
1216+
"amdgpu-no-workitem-id-z", "amdgpu-no-heap-ptr",
1217+
"amdgpu-no-flat-scratch-init"});
12171218
if (!LDSParams.IndirectAccess.StaticLDSGlobals.empty() ||
12181219
!LDSParams.IndirectAccess.DynamicLDSGlobals.empty())
12191220
removeFnAttrFromReachable(CG, Func, {"amdgpu-no-lds-kernel-id"});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
2+
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
3+
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
4+
5+
; Test to check if amdgpu-no-flat-scratch-init is removed from the kernel.
6+
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 4
7+
8+
define amdgpu_kernel void @k0() #0 {
9+
store i8 7, ptr addrspace(3) @lds_1, align 4
10+
ret void
11+
}
12+
13+
attributes #0 = { sanitize_address "amdgpu-no-flat-scratch-init"}
14+
15+
!llvm.module.flags = !{!0}
16+
!0 = !{i32 4, !"nosanitize_address", i32 1}
17+
18+
; CHECK: attributes #[[ATTR0:.*]] = { sanitize_address "amdgpu-lds-size"="8" }

0 commit comments

Comments
 (0)