diff --git a/mlir/include/mlir/IR/AffineMap.h b/mlir/include/mlir/IR/AffineMap.h --- a/mlir/include/mlir/IR/AffineMap.h +++ b/mlir/include/mlir/IR/AffineMap.h @@ -49,9 +49,16 @@ static AffineMap get(unsigned dimCount, unsigned symbolCount, MLIRContext *context); + /// Returns an affine map with `dimCount` dimensions and `symbolCount` symbols + /// mapping to the given results. The array of results cannot be empty. static AffineMap get(unsigned dimCount, unsigned symbolCount, ArrayRef results); + /// Returns an affine map with `dimCount` dimensions and `symbolCount` mapping + /// to the given results, where the number of results can be zero. + static AffineMap get(unsigned dimCount, unsigned symbolCount, + ArrayRef results, MLIRContext *context); + /// Returns a single constant result affine map. static AffineMap getConstantMap(int64_t val, MLIRContext *context); diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp --- a/mlir/lib/IR/MLIRContext.cpp +++ b/mlir/lib/IR/MLIRContext.cpp @@ -630,7 +630,7 @@ AffineMap AffineMap::get(unsigned dimCount, unsigned symbolCount, MLIRContext *context) { - return getImpl(dimCount, /*symbolCount=*/0, /*results=*/{}, context); + return getImpl(dimCount, symbolCount, /*results=*/{}, context); } AffineMap AffineMap::get(unsigned dimCount, unsigned symbolCount, @@ -640,6 +640,11 @@ return getImpl(dimCount, symbolCount, results, results[0].getContext()); } +AffineMap AffineMap::get(unsigned dimCount, unsigned symbolCount, + ArrayRef results, MLIRContext *context) { + return getImpl(dimCount, symbolCount, results, context); +} + //===----------------------------------------------------------------------===// // Integer Sets: these are allocated into the bump pointer, and are immutable. // Unlike AffineMap's, these are uniqued only if they are small.