Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mlir/lib/Dialect/Affine/IR/AffineOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1902,6 +1902,10 @@ LogicalResult AffineForOp::verifyRegions() {
if (failed(verifyDimAndSymbolIdentifiers(*this, getUpperBoundOperands(),
getUpperBoundMap().getNumDims())))
return failure();
if (getLowerBoundMap().getNumResults() < 1)
return emitOpError("expected lower bound map to have at least one result");
if (getUpperBoundMap().getNumResults() < 1)
return emitOpError("expected upper bound map to have at least one result");

unsigned opNumResults = getNumResults();
if (opNumResults == 0)
Expand Down
22 changes: 22 additions & 0 deletions mlir/test/Dialect/Affine/invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,25 @@ func.func @dynamic_dimension_index() {
}) : () -> ()
return
}

// -----

#map = affine_map<() -> ()>
#map1 = affine_map<() -> (1)>
func.func @no_lower_bound() {
// expected-error@+1 {{'affine.for' op expected lower bound map to have at least one result}}
affine.for %i = max #map() to min #map1() {
}
return
}

// -----

#map = affine_map<() -> ()>
#map1 = affine_map<() -> (1)>
func.func @no_upper_bound() {
// expected-error@+1 {{'affine.for' op expected upper bound map to have at least one result}}
affine.for %i = max #map1() to min #map() {
}
return
}