[GlobalOpt] Handle undef global_ctors gracefully
authorNikita Popov <npopov@redhat.com>
Thu, 10 Mar 2022 15:01:09 +0000 (16:01 +0100)
committerNikita Popov <npopov@redhat.com>
Thu, 10 Mar 2022 15:02:12 +0000 (16:02 +0100)
commit067c035012fc061ad6378458774ac2df117283c6
treef7c3548d9ce86fa5ca9b9f24a1ecf2f4c43f2a87
parent22f9159bed3eb0694682590b68b879df64f010c4
[GlobalOpt] Handle undef global_ctors gracefully

If there are no ctors, then this can have an arbirary zero-sized
value. The current code checks for null, but it could also be
undef or poison.

Replacing the specific null check with a check for
non-ConstantArray.
llvm/lib/Transforms/Utils/CtorUtils.cpp
llvm/test/Transforms/GlobalOpt/undef-ctor-dtor.ll [new file with mode: 0644]