Skip to content

Commit 690a059

Browse files
committed
Use ConvertToShuffle vector source value directly
1 parent ac03cea commit 690a059

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,6 @@ bool VectorCombine::isExtractExtractCheap(ExtractElementInst *Ext0,
452452
// operands to element 0.
453453
unsigned BestExtIndex = Extract0Cost > Extract1Cost ? Ext0Index : Ext1Index;
454454
unsigned BestInsIndex = Extract0Cost > Extract1Cost ? Ext1Index : Ext0Index;
455-
Value *BestVec = (Extract0Cost > Extract1Cost ? Ext1 : Ext0)->getOperand(0);
456455
InstructionCost CheapExtractCost = std::min(Extract0Cost, Extract1Cost);
457456

458457
// Extra uses of the extracts mean that we include those costs in the
@@ -492,12 +491,13 @@ bool VectorCombine::isExtractExtractCheap(ExtractElementInst *Ext0,
492491
SmallVector<int> ShuffleMask(FixedVecTy->getNumElements(),
493492
PoisonMaskElem);
494493
ShuffleMask[BestInsIndex] = BestExtIndex;
494+
NewCost += TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc,
495+
VecTy, ShuffleMask, CostKind, 0, nullptr,
496+
{ConvertToShuffle});
497+
} else {
495498
NewCost +=
496499
TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc, VecTy,
497-
ShuffleMask, CostKind, 0, nullptr, {BestVec});
498-
} else {
499-
NewCost += TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc,
500-
VecTy, {}, CostKind, 0, nullptr, {BestVec});
500+
{}, CostKind, 0, nullptr, {ConvertToShuffle});
501501
}
502502
}
503503

0 commit comments

Comments
 (0)