[Mlir-commits] [mlir] [mlir][memref] Add ValueBoundsOpInterface external models for the memref operations extract_strided_metadata and assume_alignment (PR #206466)
Matthias Springer
llvmlistbot at llvm.org
Mon Jun 29 05:09:51 PDT 2026
================
@@ -70,6 +83,37 @@ struct ExpandShapeOpInterface
}
};
+struct ExtractStridedMetadataOpInterface
+ : public ValueBoundsOpInterface::ExternalModel<
+ ExtractStridedMetadataOpInterface, memref::ExtractStridedMetadataOp> {
+ void populateBoundsForIndexValue(Operation *op, Value value,
+ ValueBoundsConstraintSet &cstr) const {
+ auto metadataOp = cast<memref::ExtractStridedMetadataOp>(op);
+
+ if (value == metadataOp.getOffset()) {
+ cstr.bound(value) == metadataOp.getConstifiedMixedOffset();
+ return;
+ }
+
+ for (auto [idx, size] : llvm::enumerate(metadataOp.getSizes())) {
+ if (value != size)
----------------
matthias-springer wrote:
This will filter out cases where a size/stride is a constant (`Attribute`). There's a better way to implement this: cast `value` to `OpResult` and check the result number. Find the corresponding offset/size/stride based on the result number.
https://github.com/llvm/llvm-project/pull/206466
More information about the Mlir-commits
mailing list