@@ -37,8 +37,8 @@ class AffineApplyExpander
37
37
public:
38
38
// / This internal class expects arguments to be non-null, checks must be
39
39
// / performed at the call site.
40
- AffineApplyExpander (OpBuilder &builder, ArrayRef<Value> dimValues,
41
- ArrayRef<Value> symbolValues, Location loc)
40
+ AffineApplyExpander (OpBuilder &builder, ValueRange dimValues,
41
+ ValueRange symbolValues, Location loc)
42
42
: builder(builder), dimValues(dimValues), symbolValues(symbolValues),
43
43
loc (loc) {}
44
44
@@ -199,8 +199,8 @@ class AffineApplyExpander
199
199
200
200
private:
201
201
OpBuilder &builder;
202
- ArrayRef<Value> dimValues;
203
- ArrayRef<Value> symbolValues;
202
+ ValueRange dimValues;
203
+ ValueRange symbolValues;
204
204
205
205
Location loc;
206
206
};
@@ -209,16 +209,17 @@ class AffineApplyExpander
209
209
// / Create a sequence of operations that implement the `expr` applied to the
210
210
// / given dimension and symbol values.
211
211
mlir::Value mlir::expandAffineExpr (OpBuilder &builder, Location loc,
212
- AffineExpr expr, ArrayRef<Value> dimValues,
213
- ArrayRef<Value> symbolValues) {
212
+ AffineExpr expr, ValueRange dimValues,
213
+ ValueRange symbolValues) {
214
214
return AffineApplyExpander (builder, dimValues, symbolValues, loc).visit (expr);
215
215
}
216
216
217
217
// / Create a sequence of operations that implement the `affineMap` applied to
218
218
// / the given `operands` (as it it were an AffineApplyOp).
219
- Optional<SmallVector<Value, 8 >> static expandAffineMap (
220
- OpBuilder &builder, Location loc, AffineMap affineMap,
221
- ArrayRef<Value> operands) {
219
+ Optional<SmallVector<Value, 8 >> static expandAffineMap (OpBuilder &builder,
220
+ Location loc,
221
+ AffineMap affineMap,
222
+ ValueRange operands) {
222
223
auto numDims = affineMap.getNumDims ();
223
224
auto expanded = functional::map (
224
225
[numDims, &builder, loc, operands](AffineExpr expr) {
@@ -244,8 +245,7 @@ Optional<SmallVector<Value, 8>> static expandAffineMap(
244
245
// / dependences that wouldn't exist in a tree reduction, but is easier to
245
246
// / recognize as a reduction by the subsequent passes.
246
247
static Value buildMinMaxReductionSeq (Location loc, CmpIPredicate predicate,
247
- ArrayRef<Value> values,
248
- OpBuilder &builder) {
248
+ ValueRange values, OpBuilder &builder) {
249
249
assert (!llvm::empty (values) && " empty min/max chain" );
250
250
251
251
auto valueIt = values.begin ();
@@ -262,9 +262,8 @@ static Value buildMinMaxReductionSeq(Location loc, CmpIPredicate predicate,
262
262
// / applied to the respective operands, and compute the maximum value across
263
263
// / the results.
264
264
Value mlir::lowerAffineLowerBound (AffineForOp op, OpBuilder &builder) {
265
- SmallVector<Value, 8 > boundOperands (op.getLowerBoundOperands ());
266
265
auto lbValues = expandAffineMap (builder, op.getLoc (), op.getLowerBoundMap (),
267
- boundOperands );
266
+ op. getLowerBoundOperands () );
268
267
if (!lbValues)
269
268
return nullptr ;
270
269
return buildMinMaxReductionSeq (op.getLoc (), CmpIPredicate::sgt, *lbValues,
@@ -275,8 +274,7 @@ Value mlir::lowerAffineLowerBound(AffineForOp op, OpBuilder &builder) {
275
274
// / values of a (potentially) multi-output affine map applied to `operands`.
276
275
static Value lowerAffineMapMin (OpBuilder &builder, Location loc, AffineMap map,
277
276
ValueRange operands) {
278
- if (auto values =
279
- expandAffineMap (builder, loc, map, llvm::to_vector<4 >(operands)))
277
+ if (auto values = expandAffineMap (builder, loc, map, operands))
280
278
return buildMinMaxReductionSeq (loc, CmpIPredicate::slt, *values, builder);
281
279
return nullptr ;
282
280
}
0 commit comments