Skip to content

Commit 5761e2c

Browse files
toppercyuxuanchen1997
authored andcommitted
[LV] Remove unnecessary variable from InnerLoopVectorizer::createBitOrPointerCast. NFC
Summary: DstVTy is already a VectorType, we don't need to cast it again. This used to be a cast to FixedVectorType that was changed to support scalable vectors. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250980
1 parent 5a26187 commit 5761e2c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2767,18 +2767,17 @@ InnerLoopVectorizer::getOrCreateVectorTripCount(BasicBlock *InsertBlock) {
27672767
Value *InnerLoopVectorizer::createBitOrPointerCast(Value *V, VectorType *DstVTy,
27682768
const DataLayout &DL) {
27692769
// Verify that V is a vector type with same number of elements as DstVTy.
2770-
auto *DstFVTy = cast<VectorType>(DstVTy);
2771-
auto VF = DstFVTy->getElementCount();
2770+
auto VF = DstVTy->getElementCount();
27722771
auto *SrcVecTy = cast<VectorType>(V->getType());
27732772
assert(VF == SrcVecTy->getElementCount() && "Vector dimensions do not match");
27742773
Type *SrcElemTy = SrcVecTy->getElementType();
2775-
Type *DstElemTy = DstFVTy->getElementType();
2774+
Type *DstElemTy = DstVTy->getElementType();
27762775
assert((DL.getTypeSizeInBits(SrcElemTy) == DL.getTypeSizeInBits(DstElemTy)) &&
27772776
"Vector elements must have same size");
27782777

27792778
// Do a direct cast if element types are castable.
27802779
if (CastInst::isBitOrNoopPointerCastable(SrcElemTy, DstElemTy, DL)) {
2781-
return Builder.CreateBitOrPointerCast(V, DstFVTy);
2780+
return Builder.CreateBitOrPointerCast(V, DstVTy);
27822781
}
27832782
// V cannot be directly casted to desired vector type.
27842783
// May happen when V is a floating point vector but DstVTy is a vector of
@@ -2792,7 +2791,7 @@ Value *InnerLoopVectorizer::createBitOrPointerCast(Value *V, VectorType *DstVTy,
27922791
IntegerType::getIntNTy(V->getContext(), DL.getTypeSizeInBits(SrcElemTy));
27932792
auto *VecIntTy = VectorType::get(IntTy, VF);
27942793
Value *CastVal = Builder.CreateBitOrPointerCast(V, VecIntTy);
2795-
return Builder.CreateBitOrPointerCast(CastVal, DstFVTy);
2794+
return Builder.CreateBitOrPointerCast(CastVal, DstVTy);
27962795
}
27972796

27982797
void InnerLoopVectorizer::emitIterationCountCheck(BasicBlock *Bypass) {

0 commit comments

Comments
 (0)