[amdgpu] Don't crash on empty global ctor/dtor
authorJon Chesterfield <jonathanchesterfield@gmail.com>
Tue, 16 Nov 2021 14:36:06 +0000 (14:36 +0000)
committerJon Chesterfield <jonathanchesterfield@gmail.com>
Tue, 16 Nov 2021 14:36:08 +0000 (14:36 +0000)
commit30b29db7c79ce70801800572b898b2e0df03bbb1
tree448e45d9ed93ec88a450e1d0ec3a6fa37d4b5530
parent8fce94f91610bc4614b1fe0bff8f143ea2b54742
[amdgpu] Don't crash on empty global ctor/dtor

Global ctor/dtor can be an empty array, which is a Constant not a
ConstantArray. The cast<ConstantArray> therefore asserts / crashes.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D113800
llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp
llvm/test/CodeGen/AMDGPU/lower-empty-ctor-dtor.ll [new file with mode: 0644]