diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -1302,4 +1302,10 @@ if (isModuleEntryFunction) EmitResourceUsageRemark("BytesLDS", "LDS Size [bytes/block]", CurrentProgramInfo.LDSSize); + if (CodeObjectVersion >= AMDGPU::AMDHSA_COV5) { + std::string UsesDynamicStackStr = + CurrentProgramInfo.DynamicCallStack ? "True" : "False"; + EmitResourceUsageRemark("UsesDynamicStack", "Uses Dynamic Stack", + UsesDynamicStackStr); + } } diff --git a/llvm/test/CodeGen/AMDGPU/resource-optimization-remarks_COV5.ll b/llvm/test/CodeGen/AMDGPU/resource-optimization-remarks_COV5.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/resource-optimization-remarks_COV5.ll @@ -0,0 +1,31 @@ +; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -pass-remarks-output=%t -pass-remarks-analysis=kernel-resource-usage -filetype=obj -o /dev/null %s 2>&1 | FileCheck -check-prefix=STDERR %s + +; STDERR: remark: test.cpp:27:0: Function Name: test_indirect_call +; STDERR-NEXT: remark: test.cpp:27:0: SGPRs: 39 +; STDERR-NEXT: remark: test.cpp:27:0: VGPRs: 32 +; STDERR-NEXT: remark: test.cpp:27:0: AGPRs: 0 +; STDERR-NEXT: remark: test.cpp:27:0: ScratchSize [bytes/lane]: 0 +; STDERR-NEXT: remark: test.cpp:27:0: Occupancy [waves/SIMD]: 8 +; STDERR-NEXT: remark: test.cpp:27:0: SGPRs Spill: 0 +; STDERR-NEXT: remark: test.cpp:27:0: VGPRs Spill: 0 +; STDERR-NEXT: remark: test.cpp:27:0: LDS Size [bytes/block]: 0 +; STDERR-NEXT: remark: test.cpp:27:0: Uses Dynamic Stack: True + +@gv.fptr0 = external hidden unnamed_addr addrspace(4) constant ptr, align 4 + +define amdgpu_kernel void @test_indirect_call() !dbg !3 { + %fptr = load ptr, ptr addrspace(4) @gv.fptr0 + call void %fptr() + ret void +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!2} +!llvm.module.flags = !{!6} +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) +!1 = !DIFile(filename: "test.cpp", directory: "/tmp") +!2 = !{i32 2, !"Debug Info Version", i32 3} +!3 = distinct !DISubprogram(name: "test_kernel", scope: !1, file: !1, type: !4, scopeLine: 27, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0) +!4 = !DISubroutineType(types: !5) +!5 = !{null} +!6 = !{i32 1, !"amdgpu_code_object_version", i32 500}