Skip to content
Merged
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
4 changes: 4 additions & 0 deletions llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1487,6 +1487,10 @@ void AMDGPUAsmPrinter::emitResourceUsageRemarks(
if (!Ctx.getDiagHandlerPtr()->isAnalysisRemarkEnabled(Name))
return;

// Currently non-kernel functions have no resources to emit.
if (!isEntryFunctionCC(MF.getFunction().getCallingConv()))
return;

auto EmitResourceUsageRemark = [&](StringRef RemarkName,
StringRef RemarkLabel, auto Argument) {
// Add an indent for every line besides the line with the kernel name. This
Expand Down
21 changes: 2 additions & 19 deletions llvm/test/CodeGen/AMDGPU/resource-optimization-remarks.ll
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,7 @@ define amdgpu_kernel void @test_kernel() !dbg !3 {
ret void
}

; STDERR: remark: foo.cl:42:0: Function Name: test_func
; STDERR-NEXT: remark: foo.cl:42:0: SGPRs: 0
; STDERR-NEXT: remark: foo.cl:42:0: VGPRs: 0
; STDERR-NEXT: remark: foo.cl:42:0: AGPRs: 0
; STDERR-NEXT: remark: foo.cl:42:0: ScratchSize [bytes/lane]: 0
; STDERR-NEXT: remark: foo.cl:42:0: Dynamic Stack: False
; STDERR-NEXT: remark: foo.cl:42:0: Occupancy [waves/SIMD]: 0
; STDERR-NEXT: remark: foo.cl:42:0: SGPRs Spill: 0
; STDERR-NEXT: remark: foo.cl:42:0: VGPRs Spill: 0
; STDERR-NOT: LDS Size
; STDERR-NOT: test_func
define void @test_func() !dbg !6 {
call void asm sideeffect "; clobber v17", "~{v17}"()
call void asm sideeffect "; clobber s11", "~{s11}"()
Expand All @@ -144,15 +135,7 @@ define amdgpu_kernel void @empty_kernel() !dbg !7 {
ret void
}

; STDERR: remark: foo.cl:52:0: Function Name: empty_func
; STDERR-NEXT: remark: foo.cl:52:0: SGPRs: 0
; STDERR-NEXT: remark: foo.cl:52:0: VGPRs: 0
; STDERR-NEXT: remark: foo.cl:52:0: AGPRs: 0
; STDERR-NEXT: remark: foo.cl:52:0: ScratchSize [bytes/lane]: 0
; STDERR-NEXT: remark: foo.cl:52:0: Dynamic Stack: False
; STDERR-NEXT: remark: foo.cl:52:0: Occupancy [waves/SIMD]: 0
; STDERR-NEXT: remark: foo.cl:52:0: SGPRs Spill: 0
; STDERR-NEXT: remark: foo.cl:52:0: VGPRs Spill: 0
; STDERR-NOT: empty_func
define void @empty_func() !dbg !8 {
ret void
}
Expand Down