diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp --- a/llvm/lib/IR/Type.cpp +++ b/llvm/lib/IR/Type.cpp @@ -217,8 +217,11 @@ if (auto *VTy = dyn_cast(this)) return VTy->getElementType()->isSized(Visited); - if (auto *TTy = dyn_cast(this)) - return TTy->getLayoutType()->isSized(Visited); + if (auto *TTy = dyn_cast(this)) { + if (Type *LTy = TTy->getLayoutType()) + return LTy->isSized(Visited); + return false; + } return cast(this)->isSized(Visited); }