[llvm] [DirectX] Bug fix for Data Scalarization crash (PR #118426)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 21:30:48 PST 2024


================
@@ -321,6 +321,18 @@ static void collectElements(Constant *Init,
     Elements.push_back(Init);
     return;
   }
+  auto *LLVMArrayType = dyn_cast<ArrayType>(Init->getType());
----------------
bogner wrote:

This should either be `cast<ArrayType>` (since the cast can't fail) or we should do the `dyn_cast` and check for null above instead of `isa`.

This is also kind of a weird name - I think `ArrayTy` is the usual abbreviation.

https://github.com/llvm/llvm-project/pull/118426


More information about the llvm-commits mailing list