[llvm] edbebda - [AMDGPU] Assert previous SGPR exists when bundling preloaded args (#118802)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 00:15:26 PST 2024


Author: Jakub Chlanda
Date: 2024-12-06T09:15:22+01:00
New Revision: edbebda4542976e7b002393cc41783f53d427b3a

URL: https://github.com/llvm/llvm-project/commit/edbebda4542976e7b002393cc41783f53d427b3a
DIFF: https://github.com/llvm/llvm-project/commit/edbebda4542976e7b002393cc41783f53d427b3a.diff

LOG: [AMDGPU] Assert previous SGPR exists when bundling preloaded args (#118802)

This came up from a downstream static analysis tool.

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index 70230b5abc5171..fc8bbb154d035d 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -2537,6 +2537,7 @@ void SITargetLowering::allocatePreloadKernArgSGPRs(
 
       // Arg is preloaded into the previous SGPR.
       if (ArgLoc.getLocVT().getStoreSize() < 4 && Alignment < 4) {
+        assert(InIdx >= 1 && "No previous SGPR");
         Info.getArgInfo().PreloadKernArgs[InIdx].Regs.push_back(
             Info.getArgInfo().PreloadKernArgs[InIdx - 1].Regs[0]);
         continue;


        


More information about the llvm-commits mailing list