return emitOpError(
"operand count and affine map dimension and symbol count must match");
+ // Verify that all operands are of `index` type.
+ for (Type t : getOperandTypes()) {
+ if (!t.isIndex())
+ return emitOpError("operands must be of type 'index'");
+ }
+
+ if (!getResult()->getType().isIndex())
+ return emitOpError("result must be of type 'index'");
+
// Verify that the operands are valid dimension and symbol identifiers.
if (failed(verifyDimAndSymbolIdentifiers(*this, getOperands(),
map.getNumDims())))
// -----
+func @affine_apply_operand_non_index(%arg0 : i32) {
+ // Custom parser automatically assigns all arguments the `index` so we must
+ // use the generic syntax here to exercise the verifier.
+ // expected-error@+1 {{operands must be of type 'index'}}
+ %0 = "affine.apply"(%arg0) {map: (d0) -> (d0)} : (i32) -> (index)
+ return
+}
+
+// -----
+
+func @affine_apply_resul_non_index(%arg0 : index) {
+ // Custom parser automatically assigns `index` as the result type so we must
+ // use the generic syntax here to exercise the verifier.
+ // expected-error@+1 {{result must be of type 'index'}}
+ %0 = "affine.apply"(%arg0) {map: (d0) -> (d0)} : (index) -> (i32)
+ return
+}
+
+// -----
+
#map = (d0)[s0] -> (d0 + s0)
func @affine_for_lower_bound_invalid_dim(%arg : index) {