[llvm] [AMDGPU][LowerModuleLDS] Handle non-dynlds zero sized type (PR #84742)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 11 04:26:31 PDT 2024
================
@@ -1398,8 +1398,8 @@ class AMDGPULowerModuleLDS {
LDSVarsToTransform.begin(), LDSVarsToTransform.end()));
for (GlobalVariable *GV : Sorted) {
- OptimizedStructLayoutField F(GV,
- DL.getTypeAllocSize(GV->getValueType()),
+ unsigned Size = DL.getTypeAllocSize(GV->getValueType());
+ OptimizedStructLayoutField F(GV, Size ? Size : 1,
----------------
Pierre-vh wrote:
It's really an edge case, it can happen if the compiler allows something like `static unsigned arr[0]` (zero-sized externals become dynlds I think)
I can try to not add it and refactor the code as needed to make it work, I just thought it wasn't really worth it for such an edge case.
https://github.com/llvm/llvm-project/pull/84742
More information about the llvm-commits
mailing list