diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/include/llvm/IR/Instructions.h @@ -2448,6 +2448,10 @@ /// StartIndexes are the first indexes of each vector being interleaved, /// substituting any indexes that were undef /// E.g. <4, -1, 2, 5, 1, 3> (Factor=3): StartIndexes=<4, 0, 2> + /// + /// Note that this does not check if the input vectors are consecutive: + /// It will return true for masks such as + /// <0, 4, 6, 1, 5, 7> (Factor=3, LaneLen=2) static bool isInterleaveMask(ArrayRef Mask, unsigned Factor, unsigned NumInputElts, SmallVectorImpl &StartIndexes); diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp @@ -264,13 +264,12 @@ // deinterleaves of 2 vectors can be lowered into the following // sequences if (EltTp.getScalarSizeInBits() < ST->getELEN()) { - auto InterleaveMask = createInterleaveMask(Mask.size() / 2, 2); // Example sequence: // vsetivli zero, 4, e8, mf4, ta, ma (ignored) // vwaddu.vv v10, v8, v9 // li a0, -1 (ignored) // vwmaccu.vx v10, a0, v9 - if (ShuffleVectorInst::isInterleaveMask(Mask, 2, Mask.size() * 2)) + if (ShuffleVectorInst::isInterleaveMask(Mask, 2, Mask.size())) return 2 * LT.first * getLMULCost(LT.second); if (Mask[0] == 0 || Mask[0] == 1) {