[llvm] [IA][RISCV] Support VP loads/stores in InterleavedAccessPass (PR #120490)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 09:08:31 PST 2025
================
@@ -630,11 +630,38 @@ getVectorDeinterleaveFactor(IntrinsicInst *II,
return true;
}
+// Return the corresponded deinterleaved mask, or nullptr if there is no valid
+// mask.
+static Value *getMask(Value *WideMask, unsigned Factor,
+ VectorType *LeafValueTy) {
+ using namespace llvm::PatternMatch;
+ if (auto *IMI = dyn_cast<IntrinsicInst>(WideMask)) {
+ SmallVector<Value *, 8> Operands;
+ SmallVector<Instruction *, 8> DeadInsts;
+ if (getVectorInterleaveFactor(IMI, Operands, DeadInsts)) {
+ assert(!Operands.empty());
+ if (Operands.size() == Factor && llvm::all_equal(Operands))
+ return Operands[0];
+ }
+ }
+
+ if (match(WideMask, m_AllOnes())) {
+ // Scale the vector length of all-ones mask.
+ ElementCount OrigEC =
+ cast<VectorType>(WideMask->getType())->getElementCount();
+ if (OrigEC.getKnownMinValue() % Factor)
+ return nullptr;
----------------
lukel97 wrote:
Is this an invariant? Can this be made into an assert?
https://github.com/llvm/llvm-project/pull/120490
More information about the llvm-commits
mailing list