From: Matt Arsenault Date: Mon, 15 Apr 2019 20:51:12 +0000 (+0000) Subject: AMDGPU: Fix unreachable when counting register usage of SGPR96 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91b4e08b810d79b4b2b96c7a17434f1fe4b354fb;p=llvm AMDGPU: Fix unreachable when counting register usage of SGPR96 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358447 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp index ea63ae35df1..cc37d152750 100644 --- a/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -705,6 +705,9 @@ AMDGPUAsmPrinter::SIFunctionResourceInfo AMDGPUAsmPrinter::analyzeResourceUsage( } else if (AMDGPU::VReg_512RegClass.contains(Reg)) { IsSGPR = false; Width = 16; + } else if (AMDGPU::SReg_96RegClass.contains(Reg)) { + IsSGPR = true; + Width = 3; } else { llvm_unreachable("Unknown register class"); } diff --git a/test/CodeGen/AMDGPU/call-graph-register-usage.ll b/test/CodeGen/AMDGPU/call-graph-register-usage.ll index 384d9dd4576..acc062eca25 100644 --- a/test/CodeGen/AMDGPU/call-graph-register-usage.ll +++ b/test/CodeGen/AMDGPU/call-graph-register-usage.ll @@ -224,6 +224,19 @@ define amdgpu_kernel void @usage_direct_recursion(i32 %n) #0 { ret void } +; Make sure there's no assert when a sgpr96 is used. +; GCN-LABEL: {{^}}count_use_sgpr96_external_call +; GCN: ; sgpr96 s[{{[0-9]+}}:{{[0-9]+}}] +; CI: NumSgprs: 48 +; VI-NOBUG: NumSgprs: 48 +; VI-BUG: NumSgprs: 96 +; GCN: NumVgprs: 24 +define amdgpu_kernel void @count_use_sgpr96_external_call() { +entry: + tail call void asm sideeffect "; sgpr96 $0", "s"(<3 x i32> ) #1 + call void @external() + ret void +} attributes #0 = { nounwind noinline norecurse } attributes #1 = { nounwind noinline norecurse }