mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 22:16:05 +00:00
[RISCV][TTI] Fix a misuse of the getShuffleCost API [NFC] (#129137)
The getShuffleCost api, in concept, expects to only deal with non-length changing shuffles. We were failing to extend the mask appropriately before invoking it. This came up in https://github.com/llvm/llvm-project/pull/128537 in discussion of a potential invariant, but is otherwise unrelated.
This commit is contained in:
parent
1b622a43c4
commit
1bd13bceec
@ -482,7 +482,6 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
|
||||
ArrayRef<const Value *> Args,
|
||||
const Instruction *CxtI) {
|
||||
Kind = improveShuffleKindFromMask(Kind, Mask, Tp, Index, SubTp);
|
||||
|
||||
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Tp);
|
||||
|
||||
// First, handle cases where having a fixed length vector enables us to
|
||||
@ -890,11 +889,12 @@ InstructionCost RISCVTTIImpl::getInterleavedMemoryOpCost(
|
||||
if (Opcode == Instruction::Load) {
|
||||
InstructionCost Cost = MemCost;
|
||||
for (unsigned Index : Indices) {
|
||||
FixedVectorType *SubVecTy =
|
||||
FixedVectorType *VecTy =
|
||||
FixedVectorType::get(FVTy->getElementType(), VF * Factor);
|
||||
auto Mask = createStrideMask(Index, Factor, VF);
|
||||
Mask.resize(VF * Factor, -1);
|
||||
InstructionCost ShuffleCost =
|
||||
getShuffleCost(TTI::ShuffleKind::SK_PermuteSingleSrc, SubVecTy, Mask,
|
||||
getShuffleCost(TTI::ShuffleKind::SK_PermuteSingleSrc, VecTy, Mask,
|
||||
CostKind, 0, nullptr, {});
|
||||
Cost += ShuffleCost;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user