diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp index e5ceb122507e16..f37b9ce7ab3443 100644 --- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp +++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp @@ -2806,7 +2806,8 @@ LogicalResult AffineIfOp::verify() { // Verify that the operands are valid dimension/symbols. if (failed(verifyDimAndSymbolIdentifiers(*this, getOperands(), - condition.getNumDims(), true))) + condition.getNumDims(), + /*allowNonAffineDimOperands=*/true))) return failure(); return success(); diff --git a/mlir/test/Dialect/Affine/invalid.mlir b/mlir/test/Dialect/Affine/invalid.mlir index 709d197bd4cf89..c1e4f6328bc270 100644 --- a/mlir/test/Dialect/Affine/invalid.mlir +++ b/mlir/test/Dialect/Affine/invalid.mlir @@ -96,7 +96,8 @@ func.func @affine_for_upper_bound_invalid_sym() { func.func @affine_if_invalid_dim(%arg : index) { affine.for %n0 = 0 to 7 { %dim = arith.addi %arg, %arg : index - + // Non-affine operand %dim has been made legal as input to affine.if. + // expected-error@+1 {{operand cannot be used as a symbol}} affine.if #set0(%dim)[%n0] {} } return @@ -108,6 +109,7 @@ func.func @affine_if_invalid_dim(%arg : index) { func.func @affine_if_invalid_sym() { affine.for %i0 = 0 to 7 { + // expected-error@+1 {{operand cannot be used as a symbol}} affine.if #set0(%i0)[%i0] {} } return