[llvm] [RISCV][IA] Factor out code for extracting operands from mem insts [nfc] (PR #149344)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 18 10:01:30 PDT 2025


================
@@ -102,6 +102,52 @@ static bool isMultipleOfN(const Value *V, const DataLayout &DL, unsigned N) {
   return false;
 }
 
+static bool getMemOperands(IRBuilderBase &Builder, unsigned Factor,
+                           VectorType *VTy, const DataLayout &DL, Type *XLenTy,
+                           Instruction *I, Value *&Ptr, Value *&Mask,
+                           Value *&VL, Align &Alignment) {
+  ElementCount EC = VTy->getElementCount();
+  if (auto *LI = dyn_cast<LoadInst>(I)) {
+    assert(LI->isSimple());
+    Ptr = LI->getPointerOperand();
+    Alignment = LI->getAlign();
+    assert(!Mask && "Unexpected mask on a load\n");
----------------
mshockwave wrote:

```suggestion
    assert(!Mask && "Unexpected mask on a load");
```

https://github.com/llvm/llvm-project/pull/149344


More information about the llvm-commits mailing list