@@ -187,7 +187,7 @@ struct ConversionValueMapping {
187
187
}
188
188
189
189
// / Drop the last mapping for the given values.
190
- void erase (ValueVector value) { mapping.erase (value); }
190
+ void erase (const ValueVector & value) { mapping.erase (value); }
191
191
192
192
private:
193
193
// / Current value mappings.
@@ -221,7 +221,7 @@ ConversionValueMapping::lookupOrDefault(ValueVector from,
221
221
}
222
222
if (next != from) {
223
223
// If at least one value was replaced, continue the lookup from there.
224
- from = next;
224
+ from = std::move ( next) ;
225
225
continue ;
226
226
}
227
227
@@ -1175,7 +1175,7 @@ UnresolvedMaterializationRewrite::UnresolvedMaterializationRewrite(
1175
1175
ValueVector mappedValues)
1176
1176
: OperationRewrite(Kind::UnresolvedMaterialization, rewriterImpl, op),
1177
1177
converterAndKind(converter, kind), originalType(originalType),
1178
- mappedValues(mappedValues) {
1178
+ mappedValues(std::move( mappedValues) ) {
1179
1179
assert ((!originalType || kind == MaterializationKind::Target) &&
1180
1180
" original type is valid only for target materializations" );
1181
1181
rewriterImpl.unresolvedMaterializations [op] = this ;
@@ -1265,9 +1265,9 @@ LogicalResult ConversionPatternRewriterImpl::remapValues(
1265
1265
ValueVector repl = mapping.lookupOrDefault ({operand}, legalTypes);
1266
1266
if (!repl.empty () && TypeRange (repl) == legalTypes) {
1267
1267
// Mapped values have the correct type or there is an existing
1268
- // materialization. Or the opreand is not mapped at all and has the
1268
+ // materialization. Or the operand is not mapped at all and has the
1269
1269
// correct type.
1270
- remapped.push_back (repl);
1270
+ remapped.push_back (std::move ( repl) );
1271
1271
continue ;
1272
1272
}
1273
1273
@@ -1416,8 +1416,7 @@ Block *ConversionPatternRewriterImpl::applySignatureConversion(
1416
1416
// used as a replacement.
1417
1417
auto replArgs =
1418
1418
newBlock->getArguments ().slice (inputMap->inputNo , inputMap->size );
1419
- ValueVector replArgVals = llvm::map_to_vector<1 >(
1420
- replArgs, [](BlockArgument arg) -> Value { return arg; });
1419
+ ValueVector replArgVals = llvm::to_vector_of<Value, 1 >(replArgs);
1421
1420
mapping.map ({origArg}, replArgVals);
1422
1421
appendRewrite<ReplaceBlockArgRewrite>(block, origArg, converter);
1423
1422
}
@@ -1462,8 +1461,8 @@ ValueRange ConversionPatternRewriterImpl::buildUnresolvedMaterialization(
1462
1461
mapping.map (valuesToMap, convertOp.getResults ());
1463
1462
if (castOp)
1464
1463
*castOp = convertOp;
1465
- appendRewrite<UnresolvedMaterializationRewrite>(convertOp, converter, kind,
1466
- originalType, valuesToMap);
1464
+ appendRewrite<UnresolvedMaterializationRewrite>(
1465
+ convertOp, converter, kind, originalType, std::move ( valuesToMap) );
1467
1466
return convertOp.getResults ();
1468
1467
}
1469
1468
@@ -1495,10 +1494,13 @@ Value ConversionPatternRewriterImpl::findOrBuildReplacementValue(
1495
1494
// `applySignatureConversion`.)
1496
1495
return Value ();
1497
1496
}
1498
- Value castValue = buildUnresolvedMaterialization (
1499
- MaterializationKind::Source, computeInsertPoint (repl), value.getLoc (),
1500
- /* valuesToMap=*/ {value}, /* inputs=*/ repl, /* outputType=*/ value.getType (),
1501
- /* originalType=*/ Type (), converter)[0 ];
1497
+ Value castValue =
1498
+ buildUnresolvedMaterialization (MaterializationKind::Source,
1499
+ computeInsertPoint (repl), value.getLoc (),
1500
+ /* valuesToMap=*/ {value}, /* inputs=*/ repl,
1501
+ /* outputType=*/ value.getType (),
1502
+ /* originalType=*/ Type (), converter)
1503
+ .front ();
1502
1504
mapping.map ({value}, {castValue});
1503
1505
return castValue;
1504
1506
}
0 commit comments