[llvm] [RISCV] Pass subvector type to isLegalInterleavedAccessType in getInterleavedMemoryOpCost. (PR #91825)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Sun May 12 19:40:20 PDT 2024
================
@@ -612,14 +612,19 @@ InstructionCost RISCVTTIImpl::getInterleavedMemoryOpCost(
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(VTy);
// Need to make sure type has't been scalarized
if (LT.second.isVector()) {
- auto *LegalVTy = VectorType::get(VTy->getElementType(),
- LT.second.getVectorElementCount());
- // FIXME: We use the memory op cost of the *legalized* type here, becuase
- // it's getMemoryOpCost returns a really expensive cost for types like
- // <6 x i8>, which show up when doing interleaves of Factor=3 etc.
- // Should the memory op cost of these be cheaper?
- if (TLI->isLegalInterleavedAccessType(LegalVTy, Factor, Alignment,
+ auto *SubVecTy =
+ VectorType::get(VTy->getElementType(),
+ VTy->getElementCount().divideCoefficientBy(Factor));
+
+ if (VTy->getElementCount().isKnownMultipleOf(Factor) &&
+ TLI->isLegalInterleavedAccessType(SubVecTy, Factor, Alignment,
AddressSpace, DL)) {
+ // FIXME: We use the memory op cost of the *legalized* type here,u
----------------
arcbbb wrote:
the trailing u can be removed.
https://github.com/llvm/llvm-project/pull/91825
More information about the llvm-commits
mailing list