Global ctor/dtor can be an empty array, which is a Constant not a
ConstantArray. The cast<ConstantArray> therefore asserts / crashes.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/CodeGen/AMDGPU/lower-empty-ctor-dtor.ll | ||
---|---|---|
2 | should we add a verify pass to make sure this is valid IR? |
Is is valid IR. There are several existing test cases with zero length global ctors.
The opt line is checking that @amdgcn.device.init kernels aren't emitted. It's disassembling instead of doing something else because it follows the pattern of lower-multiple-ctor-dtor.ll and lower-ctor-dtor.ll test cases introduced with D105682 which missed this case.
edit: don't mind if we go with this fix (which just ignores the zero length arrays) or another one, but the assert on unrelated test cases is blocking. I'm also fine with reverting D105682 while this is fixed.
I'm still not a huge fan of purely negative checks since it's so easy for them to break
I don't see what this opt line is accomplishing with the checks. Needs some positive IR checks?