[PATCH] D25589: AMDGPU: Fix using incorrect private resource with no allocation
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 14 08:03:40 PDT 2016
tstellarAMD added inline comments.
================
Comment at: lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp:465-471
+ ExtraSGPRs += 2;
- if (STM.getGeneration() < SISubtarget::VOLCANIC_ISLANDS) {
- if (FlatUsed)
- ExtraSGPRs = 4;
- } else {
- if (STM.isXNACKEnabled())
- ExtraSGPRs = 4;
+ if (FlatUsed)
+ ExtraSGPRs += 2;
- if (FlatUsed)
- ExtraSGPRs = 6;
- }
+ if (STM.isXNACKEnabled())
+ ExtraSGPRs += 2;
----------------
I don't think this is correct. For example if the shader uses 12 SGPRS , VCC and Flat. then we would allocate 12 + 4 = 16 SGPRs. This would put the flat_scratch register at s[10:11], which may also be referenced as a regular SGPR by the shader, so we may end up randomly over writing this register.
https://reviews.llvm.org/D25589
More information about the llvm-commits
mailing list