Skip to content

Commit

Permalink
Clean up usages of asserting vector getters in Type
Browse files Browse the repository at this point in the history
Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: espindola, efriedma, sdesmalen

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77275
  • Loading branch information
christetreault-llvm committed Apr 8, 2020
1 parent 49fd24f commit fe69eb1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions llvm/lib/Bitcode/Reader/BitcodeReader.cpp
Expand Up @@ -4168,7 +4168,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
if (!Vec->getType()->isVectorTy())
return error("Invalid type for value");
I = ExtractElementInst::Create(Vec, Idx);
FullTy = FullTy->getVectorElementType();
FullTy = cast<VectorType>(FullTy)->getElementType();
InstructionList.push_back(I);
break;
}
Expand Down Expand Up @@ -4202,8 +4202,9 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
return error("Invalid type for value");

I = new ShuffleVectorInst(Vec1, Vec2, Mask);
FullTy = VectorType::get(FullTy->getVectorElementType(),
Mask->getType()->getVectorElementCount());
FullTy =
VectorType::get(cast<VectorType>(FullTy)->getElementType(),
cast<VectorType>(Mask->getType())->getElementCount());
InstructionList.push_back(I);
break;
}
Expand Down Expand Up @@ -5195,8 +5196,8 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
!FullTy->isPointerTy() && !isa<StructType>(FullTy) &&
!isa<ArrayType>(FullTy) &&
(!isa<VectorType>(FullTy) ||
FullTy->getVectorElementType()->isFloatingPointTy() ||
FullTy->getVectorElementType()->isIntegerTy()) &&
cast<VectorType>(FullTy)->getElementType()->isFloatingPointTy() ||
cast<VectorType>(FullTy)->getElementType()->isIntegerTy()) &&
"Structured types must be assigned with corresponding non-opaque "
"pointer type");
}
Expand Down

0 comments on commit fe69eb1

Please sign in to comment.