Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,8 @@ bool AMDGPUSwLowerLDS::run() {
removeFnAttrFromReachable(
CG, Func,
{"amdgpu-no-workitem-id-x", "amdgpu-no-workitem-id-y",
"amdgpu-no-workitem-id-z", "amdgpu-no-heap-ptr"});
"amdgpu-no-workitem-id-z", "amdgpu-no-heap-ptr",
"amdgpu-no-flat-scratch-init"});
if (!LDSParams.IndirectAccess.StaticLDSGlobals.empty() ||
!LDSParams.IndirectAccess.DynamicLDSGlobals.empty())
removeFnAttrFromReachable(CG, Func, {"amdgpu-no-lds-kernel-id"});
Expand Down
18 changes: 18 additions & 0 deletions llvm/test/CodeGen/AMDGPU/amdgpu-sw-lower-lds-no-scratch-init.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 4
; RUN: opt < %s -passes=amdgpu-sw-lower-lds -S -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s
; RUN: llc < %s -enable-new-pm -stop-after=amdgpu-sw-lower-lds -amdgpu-asan-instrument-lds=false -mtriple=amdgcn-amd-amdhsa | FileCheck %s

; Test to check if amdgpu-no-flat-scratch-init is removed from the kernel.
@lds_1 = internal addrspace(3) global [1 x i8] poison, align 4

define amdgpu_kernel void @k0() #0 {
store i8 7, ptr addrspace(3) @lds_1, align 4
ret void
}

attributes #0 = { sanitize_address "amdgpu-no-flat-scratch-init"}

!llvm.module.flags = !{!0}
!0 = !{i32 4, !"nosanitize_address", i32 1}

; CHECK: attributes #[[ATTR0:.*]] = { sanitize_address "amdgpu-lds-size"="8" }