mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 11:02:04 +08:00
Apply clang-tidy fixes for performance-move-const-arg to MLIR (NFC)
This commit is contained in:
@@ -117,9 +117,9 @@ PresburgerSet PresburgerSet::intersect(const PresburgerSet &set) const {
|
||||
for (const FlatAffineConstraints &csB : set.flatAffineConstraints) {
|
||||
FlatAffineConstraints csACopy = csA, csBCopy = csB;
|
||||
csACopy.mergeLocalIds(csBCopy);
|
||||
csACopy.append(std::move(csBCopy));
|
||||
csACopy.append(csBCopy);
|
||||
if (!csACopy.isEmpty())
|
||||
result.unionFACInPlace(std::move(csACopy));
|
||||
result.unionFACInPlace(csACopy);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -696,8 +696,7 @@ void mlir::python::populateIRAffine(py::module &m) {
|
||||
DefaultingPyMlirContext context) {
|
||||
SmallVector<MlirAffineExpr> affineExprs;
|
||||
pyListToVector<PyAffineExpr, MlirAffineExpr>(
|
||||
std::move(exprs), affineExprs,
|
||||
"attempting to create an AffineMap");
|
||||
exprs, affineExprs, "attempting to create an AffineMap");
|
||||
MlirAffineMap map =
|
||||
mlirAffineMapGet(context->get(), dimCount, symbolCount,
|
||||
affineExprs.size(), affineExprs.data());
|
||||
|
||||
@@ -1357,13 +1357,12 @@ PyOpView::buildGeneric(const py::object &cls, py::list resultTypeList,
|
||||
}
|
||||
|
||||
// Delegate to create.
|
||||
return PyOperation::create(std::move(name),
|
||||
return PyOperation::create(name,
|
||||
/*results=*/std::move(resultTypes),
|
||||
/*operands=*/std::move(operands),
|
||||
/*attributes=*/std::move(attributes),
|
||||
/*successors=*/std::move(successors),
|
||||
/*regions=*/*regions, location,
|
||||
std::move(maybeIp));
|
||||
/*regions=*/*regions, location, maybeIp);
|
||||
}
|
||||
|
||||
PyOpView::PyOpView(const py::object &operationObject)
|
||||
@@ -1705,7 +1704,7 @@ void PySymbolTable::walkSymbolTables(PyOperationBase &from,
|
||||
if (userData.gotException) {
|
||||
std::string message("Exception raised in callback: ");
|
||||
message.append(userData.exceptionWhat);
|
||||
throw std::runtime_error(std::move(message));
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ static void getConstraintPredicates(pdl::ApplyNativeConstraintOp op,
|
||||
Position *pos = *std::max_element(allPositions.begin(), allPositions.end(),
|
||||
comparePosDepth);
|
||||
PredicateBuilder::Predicate pred =
|
||||
builder.getConstraint(op.name(), std::move(allPositions), parameters);
|
||||
builder.getConstraint(op.name(), allPositions, parameters);
|
||||
predList.emplace_back(pos, pred);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,7 @@ ArrayRef<ReductionNode *> ReductionNode::generateNewVariants() {
|
||||
int oldNumVariant = getVariants().size();
|
||||
|
||||
auto createNewNode = [this](std::vector<Range> ranges) {
|
||||
return new (allocator.Allocate())
|
||||
ReductionNode(this, std::move(ranges), allocator);
|
||||
return new (allocator.Allocate()) ReductionNode(this, ranges, allocator);
|
||||
};
|
||||
|
||||
// If we haven't created new variant, then we can create varients by removing
|
||||
|
||||
@@ -92,7 +92,7 @@ static LogicalResult findOptimal(ModuleOp module, Region ®ion,
|
||||
{0, std::distance(region.op_begin(), region.op_end())}};
|
||||
|
||||
ReductionNode *root = allocator.Allocate();
|
||||
new (root) ReductionNode(nullptr, std::move(ranges), allocator);
|
||||
new (root) ReductionNode(nullptr, ranges, allocator);
|
||||
// Duplicate the module for root node and locate the region in the copy.
|
||||
if (failed(root->initialize(module, region)))
|
||||
llvm_unreachable("unexpected initialization failure");
|
||||
|
||||
@@ -196,9 +196,9 @@ public:
|
||||
TimerImpl *nest(const void *id, function_ref<std::string()> nameBuilder) {
|
||||
auto tid = llvm::get_threadid();
|
||||
if (tid == threadId)
|
||||
return nestTail(children[id], std::move(nameBuilder));
|
||||
return nestTail(children[id], nameBuilder);
|
||||
std::unique_lock<std::mutex> lock(asyncMutex);
|
||||
return nestTail(asyncChildren[tid][id], std::move(nameBuilder));
|
||||
return nestTail(asyncChildren[tid][id], nameBuilder);
|
||||
}
|
||||
|
||||
/// Tail-called from `nest()`.
|
||||
@@ -524,7 +524,7 @@ void DefaultTimingManager::stopTimer(void *handle) {
|
||||
|
||||
void *DefaultTimingManager::nestTimer(void *handle, const void *id,
|
||||
function_ref<std::string()> nameBuilder) {
|
||||
return static_cast<TimerImpl *>(handle)->nest(id, std::move(nameBuilder));
|
||||
return static_cast<TimerImpl *>(handle)->nest(id, nameBuilder);
|
||||
}
|
||||
|
||||
void DefaultTimingManager::hideTimer(void *handle) {
|
||||
|
||||
@@ -736,8 +736,7 @@ LogicalResult CppEmitter::emitAttribute(Location loc, Attribute attr) {
|
||||
}
|
||||
if (auto dense = attr.dyn_cast<DenseFPElementsAttr>()) {
|
||||
os << '{';
|
||||
interleaveComma(dense, os,
|
||||
[&](APFloat val) { printFloat(std::move(val)); });
|
||||
interleaveComma(dense, os, [&](APFloat val) { printFloat(val); });
|
||||
os << '}';
|
||||
return success();
|
||||
}
|
||||
@@ -760,7 +759,7 @@ LogicalResult CppEmitter::emitAttribute(Location loc, Attribute attr) {
|
||||
.dyn_cast<IntegerType>()) {
|
||||
os << '{';
|
||||
interleaveComma(dense, os, [&](APInt val) {
|
||||
printInt(std::move(val), shouldMapToUnsigned(iType.getSignedness()));
|
||||
printInt(val, shouldMapToUnsigned(iType.getSignedness()));
|
||||
});
|
||||
os << '}';
|
||||
return success();
|
||||
@@ -770,8 +769,7 @@ LogicalResult CppEmitter::emitAttribute(Location loc, Attribute attr) {
|
||||
.getElementType()
|
||||
.dyn_cast<IndexType>()) {
|
||||
os << '{';
|
||||
interleaveComma(dense, os,
|
||||
[&](APInt val) { printInt(std::move(val), false); });
|
||||
interleaveComma(dense, os, [&](APInt val) { printInt(val, false); });
|
||||
os << '}';
|
||||
return success();
|
||||
}
|
||||
|
||||
@@ -140,24 +140,24 @@ TEST_F(OpBuildGenTest, BuildMethodsSingleVariadicArgAndResult) {
|
||||
// Test collective args, collective results method, building a unary op.
|
||||
auto op = builder.create<test::TableGenBuildOp1>(loc, TypeRange{i32Ty},
|
||||
ValueRange{*cstI32});
|
||||
verifyOp(std::move(op), {i32Ty}, {*cstI32}, noAttrs);
|
||||
verifyOp(op, {i32Ty}, {*cstI32}, noAttrs);
|
||||
|
||||
// Test collective args, collective results method, building a unary op with
|
||||
// named attributes.
|
||||
op = builder.create<test::TableGenBuildOp1>(loc, TypeRange{i32Ty},
|
||||
ValueRange{*cstI32}, attrs);
|
||||
verifyOp(std::move(op), {i32Ty}, {*cstI32}, attrs);
|
||||
verifyOp(op, {i32Ty}, {*cstI32}, attrs);
|
||||
|
||||
// Test collective args, collective results method, building a binary op.
|
||||
op = builder.create<test::TableGenBuildOp1>(loc, TypeRange{i32Ty, f32Ty},
|
||||
ValueRange{*cstI32, *cstF32});
|
||||
verifyOp(std::move(op), {i32Ty, f32Ty}, {*cstI32, *cstF32}, noAttrs);
|
||||
verifyOp(op, {i32Ty, f32Ty}, {*cstI32, *cstF32}, noAttrs);
|
||||
|
||||
// Test collective args, collective results method, building a binary op with
|
||||
// named attributes.
|
||||
op = builder.create<test::TableGenBuildOp1>(
|
||||
loc, TypeRange{i32Ty, f32Ty}, ValueRange{*cstI32, *cstF32}, attrs);
|
||||
verifyOp(std::move(op), {i32Ty, f32Ty}, {*cstI32, *cstF32}, attrs);
|
||||
verifyOp(op, {i32Ty, f32Ty}, {*cstI32, *cstF32}, attrs);
|
||||
}
|
||||
|
||||
/// Test build methods for an Op with a single varadic arg and a non-variadic
|
||||
@@ -166,22 +166,22 @@ TEST_F(OpBuildGenTest, BuildMethodsSingleVariadicArgNonVariadicResults) {
|
||||
// Test separate arg, separate param build method.
|
||||
auto op =
|
||||
builder.create<test::TableGenBuildOp1>(loc, i32Ty, ValueRange{*cstI32});
|
||||
verifyOp(std::move(op), {i32Ty}, {*cstI32}, noAttrs);
|
||||
verifyOp(op, {i32Ty}, {*cstI32}, noAttrs);
|
||||
|
||||
// Test collective params build method, no attributes.
|
||||
op = builder.create<test::TableGenBuildOp1>(loc, TypeRange{i32Ty},
|
||||
ValueRange{*cstI32});
|
||||
verifyOp(std::move(op), {i32Ty}, {*cstI32}, noAttrs);
|
||||
verifyOp(op, {i32Ty}, {*cstI32}, noAttrs);
|
||||
|
||||
// Test collective params build method no attributes, 2 inputs.
|
||||
op = builder.create<test::TableGenBuildOp1>(loc, TypeRange{i32Ty},
|
||||
ValueRange{*cstI32, *cstF32});
|
||||
verifyOp(std::move(op), {i32Ty}, {*cstI32, *cstF32}, noAttrs);
|
||||
verifyOp(op, {i32Ty}, {*cstI32, *cstF32}, noAttrs);
|
||||
|
||||
// Test collective params build method, non-empty attributes.
|
||||
op = builder.create<test::TableGenBuildOp1>(
|
||||
loc, TypeRange{i32Ty}, ValueRange{*cstI32, *cstF32}, attrs);
|
||||
verifyOp(std::move(op), {i32Ty}, {*cstI32, *cstF32}, attrs);
|
||||
verifyOp(op, {i32Ty}, {*cstI32, *cstF32}, attrs);
|
||||
}
|
||||
|
||||
/// Test build methods for an Op with a single varadic arg and multiple variadic
|
||||
@@ -191,17 +191,17 @@ TEST_F(OpBuildGenTest,
|
||||
// Test separate arg, separate param build method.
|
||||
auto op = builder.create<test::TableGenBuildOp3>(
|
||||
loc, TypeRange{i32Ty}, TypeRange{f32Ty}, ValueRange{*cstI32});
|
||||
verifyOp(std::move(op), {i32Ty, f32Ty}, {*cstI32}, noAttrs);
|
||||
verifyOp(op, {i32Ty, f32Ty}, {*cstI32}, noAttrs);
|
||||
|
||||
// Test collective params build method, no attributes.
|
||||
op = builder.create<test::TableGenBuildOp3>(loc, TypeRange{i32Ty, f32Ty},
|
||||
ValueRange{*cstI32});
|
||||
verifyOp(std::move(op), {i32Ty, f32Ty}, {*cstI32}, noAttrs);
|
||||
verifyOp(op, {i32Ty, f32Ty}, {*cstI32}, noAttrs);
|
||||
|
||||
// Test collective params build method, with attributes.
|
||||
op = builder.create<test::TableGenBuildOp3>(loc, TypeRange{i32Ty, f32Ty},
|
||||
ValueRange{*cstI32}, attrs);
|
||||
verifyOp(std::move(op), {i32Ty, f32Ty}, {*cstI32}, attrs);
|
||||
verifyOp(op, {i32Ty, f32Ty}, {*cstI32}, attrs);
|
||||
}
|
||||
|
||||
// The next 2 tests test supression of ambiguous build methods for ops that
|
||||
@@ -223,7 +223,7 @@ TEST_F(OpBuildGenTest, BuildMethodsRegionsAndInferredType) {
|
||||
auto op = builder.create<test::TableGenBuildOp6>(
|
||||
loc, ValueRange{*cstI32, *cstF32}, /*attributes=*/noAttrs);
|
||||
ASSERT_EQ(op->getNumRegions(), 1u);
|
||||
verifyOp(std::move(op), {i32Ty}, {*cstI32, *cstF32}, noAttrs);
|
||||
verifyOp(op, {i32Ty}, {*cstI32, *cstF32}, noAttrs);
|
||||
}
|
||||
|
||||
} // namespace mlir
|
||||
|
||||
Reference in New Issue
Block a user