[llvm] [IA][RISCV] Support VP loads/stores in InterleavedAccessPass (PR #120490)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 28 14:06:55 PST 2025
================
@@ -630,11 +630,34 @@ getVectorDeinterleaveFactor(IntrinsicInst *II,
return true;
}
+/// Check the interleaved mask
+///
+/// - if a value within the optional is non-nullptr, the value corresponds to
+/// deinterleaved mask
+/// - if a value within the option is nullptr, the value corresponds to all-true
+/// mask
+/// - return nullopt if mask cannot be deinterleaved
+static Value *getMask(Value *WideMask, unsigned Factor) {
+ 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()))
+ return WideMask;
----------------
mshockwave wrote:
> Oh I see it's because after the tuple types in #97992 we don't have another vector to add attach a `LLVMScalarOrSameVectorWidth` type to. I'm not sure if there's an easy fix for this cc) @4vtomat
A potential solution would be allowing us to supply a custom code fragment to `LLVMScalarOrSameVectorWidth` to retrieve the vector type we want to match against. For instance:
```
LLVMScalarOrSameVectorWidth<0, [{ return cast<TargetExtType>(Ty)->getTypeParameter(0); }], llvm_i1_ty>;
```
where `Ty` is an implicit `Type *` variable representing the original intrinsic parameter type.
https://github.com/llvm/llvm-project/pull/120490
More information about the llvm-commits
mailing list