[PATCH] D128320: AMDGPU: Don't crash on global_ctor/dtor declaration

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 03:17:39 PDT 2022


nhaehnle added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUCtorDtorLowering.cpp:56
     ConstantArray *GA = dyn_cast<ConstantArray>(GV->getInitializer());
     if (!GA || GA->getNumOperands() == 0)
       return false;
----------------
foad wrote:
> Don't need the `!GA` check here any more.
> 
> Alternatively you could use dyn_cast_or_null on line 55.
Isn't this just being defensive about what type the initializer is? That seems wise to me, you also wouldn't need a dyn_cast otherwise.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128320/new/

https://reviews.llvm.org/D128320



More information about the llvm-commits mailing list