-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Open
Labels
llvm:analysisIncludes value tracking, cost tables and constant foldingIncludes value tracking, cost tables and constant folding
Description
As discussed on #144690 and #141634 - we're making too many assumptions about how length changing shuffles are legalized by the target. These need to be driven by the actual target implementations.
Additionally - like getInstructionCost - improveShuffleKindFromMask needs to be able to recognize a SK_PermuteSingleSrc class shuffle that has been miss-tagged as a SK_PermuteTwoSrc class.
llvm-project/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
Lines 1527 to 1547 in bb8c42e
| case Instruction::ShuffleVector: { | |
| auto *Shuffle = dyn_cast<ShuffleVectorInst>(U); | |
| if (!Shuffle) | |
| return TTI::TCC_Basic; // FIXME | |
| auto *VecTy = cast<VectorType>(U->getType()); | |
| auto *VecSrcTy = cast<VectorType>(Operands[0]->getType()); | |
| ArrayRef<int> Mask = Shuffle->getShuffleMask(); | |
| int NumSubElts, SubIndex; | |
| // TODO: move more of this inside improveShuffleKindFromMask. | |
| if (Shuffle->changesLength()) { | |
| // Treat a 'subvector widening' as a free shuffle. | |
| if (Shuffle->increasesLength() && Shuffle->isIdentityWithPadding()) | |
| return 0; | |
| if (Shuffle->isExtractSubvectorMask(SubIndex)) | |
| return TargetTTI->getShuffleCost(TTI::SK_ExtractSubvector, VecTy, | |
| VecSrcTy, Mask, CostKind, SubIndex, | |
| VecTy, Operands, Shuffle); | |
Metadata
Metadata
Assignees
Labels
llvm:analysisIncludes value tracking, cost tables and constant foldingIncludes value tracking, cost tables and constant folding