Skip to content

Commit 28c0d9d

Browse files
[mlir] Use llvm::append_range (NFC) (#136257)
This patch replaces: llvm::copy(Src, std::back_inserter(Dst)); with: llvm::append_range(Dst, Src); for breavity. One side benefit is that llvm::append_range eventually calls llvm::SmallVector::reserve if Dst is of llvm::SmallVector.
1 parent 3250301 commit 28c0d9d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

mlir/lib/Dialect/EmitC/IR/EmitC.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ Block &emitc::SwitchOp::getCaseBlock(unsigned idx) {
13371337

13381338
void SwitchOp::getSuccessorRegions(
13391339
RegionBranchPoint point, SmallVectorImpl<RegionSuccessor> &successors) {
1340-
llvm::copy(getRegions(), std::back_inserter(successors));
1340+
llvm::append_range(successors, getRegions());
13411341
}
13421342

13431343
void SwitchOp::getEntrySuccessorRegions(
@@ -1348,7 +1348,7 @@ void SwitchOp::getEntrySuccessorRegions(
13481348
// If a constant was not provided, all regions are possible successors.
13491349
auto arg = dyn_cast_or_null<IntegerAttr>(adaptor.getArg());
13501350
if (!arg) {
1351-
llvm::copy(getRegions(), std::back_inserter(successors));
1351+
llvm::append_range(successors, getRegions());
13521352
return;
13531353
}
13541354

mlir/lib/Dialect/SCF/IR/SCF.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ LoopNest mlir::scf::buildLoopNest(
758758

759759
// Return the loops.
760760
ValueVector nestResults;
761-
llvm::copy(loops.front().getResults(), std::back_inserter(nestResults));
761+
llvm::append_range(nestResults, loops.front().getResults());
762762
return LoopNest{std::move(loops), std::move(nestResults)};
763763
}
764764

@@ -4281,7 +4281,7 @@ void IndexSwitchOp::getSuccessorRegions(
42814281
return;
42824282
}
42834283

4284-
llvm::copy(getRegions(), std::back_inserter(successors));
4284+
llvm::append_range(successors, getRegions());
42854285
}
42864286

42874287
void IndexSwitchOp::getEntrySuccessorRegions(
@@ -4292,7 +4292,7 @@ void IndexSwitchOp::getEntrySuccessorRegions(
42924292
// If a constant was not provided, all regions are possible successors.
42934293
auto arg = dyn_cast_or_null<IntegerAttr>(adaptor.getArg());
42944294
if (!arg) {
4295-
llvm::copy(getRegions(), std::back_inserter(successors));
4295+
llvm::append_range(successors, getRegions());
42964296
return;
42974297
}
42984298

mlir/lib/Dialect/Traits.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ bool OpTrait::util::getBroadcastedShape(ArrayRef<int64_t> shape1,
7070

7171
resultShape.clear();
7272
if (shape1.size() > shape2.size()) {
73-
std::copy(shape1.begin(), shape1.end(), std::back_inserter(resultShape));
73+
llvm::append_range(resultShape, shape1);
7474
} else {
75-
std::copy(shape2.begin(), shape2.end(), std::back_inserter(resultShape));
75+
llvm::append_range(resultShape, shape2);
7676
}
7777

7878
auto i1 = shape1.rbegin(), e1 = shape1.rend();

0 commit comments

Comments
 (0)