[Mlir-commits] [mlir] [MLIR][Affine] Add test pass for affine isContiguousAccess (PR #82923)
Uday Bondhugula
llvmlistbot at llvm.org
Tue Feb 27 05:41:52 PST 2024
================
@@ -344,10 +333,12 @@ bool mlir::affine::isVectorizableLoopBody(
auto load = dyn_cast<AffineLoadOp>(op);
auto store = dyn_cast<AffineStoreOp>(op);
int thisOpMemRefDim = -1;
- bool isContiguous = load ? isContiguousAccess(loop.getInductionVar(), load,
- &thisOpMemRefDim)
- : isContiguousAccess(loop.getInductionVar(), store,
- &thisOpMemRefDim);
+ bool isContiguous =
+ load ? isContiguousAccess(loop.getInductionVar(),
+ (AffineReadOpInterface)load, &thisOpMemRefDim)
----------------
bondhugula wrote:
But `cast<interface>(load)` won't work here - note that `load` is a derived op type!
```
...lib/Dialect/Affine/Analysis/LoopAnalysis.cpp:338:62: required from here
.../llvm/include/llvm/Support/Casting.h:64:64: error: cannot convert ‘const mlir::affine::AffineLoadOp*’ to ‘mlir::Operation*’
64 | static inline bool doit(const From &Val) { return To::classof(&Val); }
```
You'll have to do `cast<interface>(*load)`, which would work. Would you prefer this still?
https://github.com/llvm/llvm-project/pull/82923
More information about the Mlir-commits
mailing list