diff options
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp index b90d245b7bd3..682c29457c35 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -900,6 +900,15 @@ void AMDGPUAsmPrinter::getSIProgramInfo(SIProgramInfo &ProgInfo, ProgInfo.NumVGPR = AMDGPUMCExpr::createTotalNumVGPR( ProgInfo.NumAccVGPR, ProgInfo.NumArchVGPR, Ctx); + } else if (isKernel(F.getCallingConv()) && + MFI->getNumKernargPreloadedSGPRs()) { + // Consider cases where the total number of UserSGPRs with trailing + // allocated preload SGPRs, is greater than the number of explicitly + // referenced SGPRs. + const MCExpr *UserPlusExtraSGPRs = MCBinaryExpr::createAdd( + CreateExpr(MFI->getNumUserSGPRs()), ExtraSGPRs, Ctx); + ProgInfo.NumSGPR = + AMDGPUMCExpr::createMax({ProgInfo.NumSGPR, UserPlusExtraSGPRs}, Ctx); } // Adjust number of registers used to meet default/requested minimum/maximum |
