File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1398,6 +1398,10 @@ class AMDGPULowerModuleLDS {
1398
1398
LDSVarsToTransform.begin (), LDSVarsToTransform.end ()));
1399
1399
1400
1400
for (GlobalVariable *GV : Sorted) {
1401
+ if (DL.getTypeAllocSize (GV->getValueType ()) == 0 )
1402
+ report_fatal_error (" cannot lower LDS '" + GV->getName () +
1403
+ " ' because it has a zero-sized type" );
1404
+
1401
1405
OptimizedStructLayoutField F (GV,
1402
1406
DL.getTypeAllocSize (GV->getValueType ()),
1403
1407
AMDGPU::getAlign (DL, GV));
Original file line number Diff line number Diff line change
1
+ ; RUN: not --crash opt -S -mtriple=amdgcn-- -amdgpu-lower-module-lds --amdgpu-lower-module-lds-strategy=module < %s 2>&1 | FileCheck %s
2
+ ; RUN: not --crash opt -S -mtriple=amdgcn-- -passes=amdgpu-lower-module-lds --amdgpu-lower-module-lds-strategy=module < %s 2>&1 | FileCheck %s
3
+
4
+ ; CHECK: LLVM ERROR: cannot lower LDS 'var0' because it has a zero-sized type
5
+ @var0 = internal addrspace (3 ) global [0 x float ] poison, align 4
6
+
7
+ define amdgpu_kernel void @kernel () {
8
+ load float , ptr addrspace (3 ) @var0
9
+ ret void
10
+ }
You can’t perform that action at this time.
0 commit comments