[flang-commits] [flang] [clang-tools-extra] [clang] [mlir] [llvm] [compiler-rt] [mlir][vector] Fix invalid `LoadOp` indices being created (PR #76292)
Mehdi Amini via flang-commits
flang-commits at lists.llvm.org
Tue Jan 2 07:15:31 PST 2024
================
@@ -866,16 +866,41 @@ struct TransferOpConversion : public VectorToSCFPattern<OpTy> {
this->setHasBoundedRewriteRecursion();
}
+ static void getMaskBufferLoadIndices(OpTy xferOp, Value castedMaskBuffer,
+ SmallVector<Value, 8> &loadIndices,
+ Value iv) {
+ assert(xferOp.getMask() && "Expected transfer op to have mask");
+
+ // Add load indices from the previous iteration.
+ // The mask buffer depends on the permutation map, which makes determining
+ // the indices quite complex, so this is why we need to "look back" to the
+ // previous iteration to find the right indices.
+ Value maskBuffer = getMaskBuffer(xferOp);
+ for (OpOperand &use : maskBuffer.getUses()) {
+ // If there is no previous load op, then the indices are empty.
+ if (auto loadOp = dyn_cast<memref::LoadOp>(use.getOwner())) {
----------------
joker-eph wrote:
```suggestion
for (Operation *user : maskBuffer.getUsers()) {
// If there is no previous load op, then the indices are empty.
if (auto loadOp = dyn_cast<memref::LoadOp>(user)) {
```
https://github.com/llvm/llvm-project/pull/76292
More information about the flang-commits
mailing list