Skip to content

Commit 5c694ff

Browse files
committed
move ScalarTy to reduce duplicate
1 parent 66750f6 commit 5c694ff

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,8 @@ bool VectorCombine::foldInsExtFNeg(Instruction &I) {
667667

668668
auto *VecTy = cast<FixedVectorType>(I.getType());
669669
auto *SrcVecTy = cast<FixedVectorType>(SrcVec->getType());
670-
if (SrcVecTy->getScalarType() != VecTy->getScalarType())
670+
auto *ScalarTy = SrcVecTy->getScalarType();
671+
if (ScalarTy != VecTy->getScalarType())
671672
return false;
672673

673674
// Ignore bogus insert/extract index.
@@ -681,8 +682,6 @@ bool VectorCombine::foldInsExtFNeg(Instruction &I) {
681682
SmallVector<int> Mask(NumElts);
682683
std::iota(Mask.begin(), Mask.end(), 0);
683684
Mask[Index] = Index + NumElts;
684-
685-
Type *ScalarTy = SrcVecTy->getScalarType();
686685
InstructionCost OldCost =
687686
TTI.getArithmeticInstrCost(Instruction::FNeg, ScalarTy, CostKind) +
688687
TTI.getVectorInstrCost(I, VecTy, CostKind, Index);

0 commit comments

Comments
 (0)