[Mlir-commits] [mlir] [mlir][affine] Guard invalid dim attribute in the test-reify-bound pass (PR #129013)
Matthias Springer
llvmlistbot at llvm.org
Thu Mar 6 01:54:20 PST 2025
================
@@ -84,6 +84,13 @@ static LogicalResult testReifyValueBounds(FunctionOpInterface funcOp,
auto boundType = op.getBoundType();
Value value = op.getVar();
std::optional<int64_t> dim = op.getDim();
+ auto shapedType = dyn_cast<ShapedType>(value.getType());
+ if (shapedType && shapedType.hasRank() && dim.has_value() &&
+ dim.value() >= shapedType.getRank()) {
----------------
matthias-springer wrote:
nit: you could also check that the dim is not negative
https://github.com/llvm/llvm-project/pull/129013
More information about the Mlir-commits
mailing list