From 68b03aee1a15678ab5b518148d5e75c9dc0436fd Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Mon, 6 Apr 2020 17:03:49 -0700 Subject: Remove SequentialType from the type heirarchy. Now that we have scalable vectors, there's a distinction that isn't getting captured in the original SequentialType: some vectors don't have a known element count, so counting the number of elements doesn't make sense. In some cases, there's a better way to express the commonality using other methods. If we're dealing with GEPs, there's GEP methods; if we're dealing with a ConstantDataSequential, we can query its element type directly. In the relatively few remaining cases, I just decided to write out the type checks. We're talking about relatively few places, and I think the abstraction doesn't really carry its weight. (See thread "[RFC] Refactor class hierarchy of VectorType in the IR" on llvmdev.) Differential Revision: https://reviews.llvm.org/D75661 --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 16d3b79..6a72ed8 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2505,7 +2505,11 @@ Error BitcodeReader::parseConstants() { if (Record.empty()) return error("Invalid record"); - Type *EltTy = cast(CurTy)->getElementType(); + Type *EltTy; + if (auto *Array = dyn_cast(CurTy)) + EltTy = Array->getElementType(); + else + EltTy = cast(CurTy)->getElementType(); if (EltTy->isIntegerTy(8)) { SmallVector Elts(Record.begin(), Record.end()); if (isa(CurTy)) -- cgit v1.1