@@ -330,64 +330,6 @@ static DiagnosedSilenceableFailure containsAll(ArrayRef<unsigned> reference,
330
330
return DiagnosedSilenceableFailure::success ();
331
331
}
332
332
333
- // / Populates `result` with the positional identifiers relative to `maxNumber`.
334
- // / If `isAll` is set, the result will contain all numbers from `0` to
335
- // / `maxNumber - 1` inclusive regardless of `rawList`. Otherwise, negative
336
- // / values from `rawList` are are interpreted as counting backwards from
337
- // / `maxNumber`, i.e., `-1` is interpreted a `maxNumber - 1`, while positive
338
- // / numbers remain as is. If `isInverted` is set, populates `result` with those
339
- // / values from the `0` to `maxNumber - 1` inclusive range that don't appear in
340
- // / `rawList`. If `rawList` contains values that are greater than or equal to
341
- // / `maxNumber` or less than `-maxNumber`, produces a silenceable error at the
342
- // / given location. `maxNumber` must be positive. If `rawList` contains
343
- // / duplicate numbers or numbers that become duplicate after negative value
344
- // / remapping, emits a silenceable error.
345
- static DiagnosedSilenceableFailure
346
- expandTargetSpecification (Location loc, bool isAll, bool isInverted,
347
- ArrayRef<int64_t > rawList, int64_t maxNumber,
348
- SmallVectorImpl<int64_t > &result) {
349
- assert (maxNumber > 0 && " expected size to be positive" );
350
- assert (!(isAll && isInverted) && " cannot invert all" );
351
- if (isAll) {
352
- result = llvm::to_vector (llvm::seq<int64_t >(0 , maxNumber));
353
- return DiagnosedSilenceableFailure::success ();
354
- }
355
-
356
- SmallVector<int64_t > expanded;
357
- llvm::SmallDenseSet<int64_t > visited;
358
- expanded.reserve (rawList.size ());
359
- SmallVectorImpl<int64_t > &target = isInverted ? expanded : result;
360
- for (int64_t raw : rawList) {
361
- int64_t updated = raw < 0 ? maxNumber + raw : raw;
362
- if (updated >= maxNumber) {
363
- return emitSilenceableFailure (loc)
364
- << " position overflow " << updated << " (updated from " << raw
365
- << " ) for maximum " << maxNumber;
366
- }
367
- if (updated < 0 ) {
368
- return emitSilenceableFailure (loc) << " position underflow " << updated
369
- << " (updated from " << raw << " )" ;
370
- }
371
- if (!visited.insert (updated).second ) {
372
- return emitSilenceableFailure (loc) << " repeated position " << updated
373
- << " (updated from " << raw << " )" ;
374
- }
375
- target.push_back (updated);
376
- }
377
-
378
- if (!isInverted)
379
- return DiagnosedSilenceableFailure::success ();
380
-
381
- result.reserve (result.size () + (maxNumber - expanded.size ()));
382
- for (int64_t candidate : llvm::seq<int64_t >(0 , maxNumber)) {
383
- if (llvm::is_contained (expanded, candidate))
384
- continue ;
385
- result.push_back (candidate);
386
- }
387
-
388
- return DiagnosedSilenceableFailure::success ();
389
- }
390
-
391
333
// ===----------------------------------------------------------------------===//
392
334
// MatchStructuredDimOp
393
335
// ===----------------------------------------------------------------------===//
0 commit comments