@@ -53,16 +53,6 @@ static void logFailure(llvm::ScopedPrinter &os, StringRef fmt, Args &&...args) {
53
53
});
54
54
}
55
55
56
- // / Helper function that computes an insertion point where the given value is
57
- // / defined and can be used without a dominance violation.
58
- static OpBuilder::InsertPoint computeInsertPoint (Value value) {
59
- Block *insertBlock = value.getParentBlock ();
60
- Block::iterator insertPt = insertBlock->begin ();
61
- if (OpResult inputRes = dyn_cast<OpResult>(value))
62
- insertPt = ++inputRes.getOwner ()->getIterator ();
63
- return OpBuilder::InsertPoint (insertBlock, insertPt);
64
- }
65
-
66
56
// ===----------------------------------------------------------------------===//
67
57
// ConversionValueMapping
68
58
// ===----------------------------------------------------------------------===//
@@ -1147,8 +1137,9 @@ LogicalResult ConversionPatternRewriterImpl::remapValues(
1147
1137
// that the value was replaced with a value of different type and no
1148
1138
// source materialization was created yet.
1149
1139
Value castValue = buildUnresolvedMaterialization (
1150
- MaterializationKind::Target, computeInsertPoint (newOperand),
1151
- operandLoc, /* inputs=*/ newOperand, /* outputType=*/ desiredType,
1140
+ MaterializationKind::Target,
1141
+ OpBuilder::InsertPoint::after (newOperand), operandLoc,
1142
+ /* inputs=*/ newOperand, /* outputType=*/ desiredType,
1152
1143
/* originalType=*/ origType, currentTypeConverter);
1153
1144
mapping.map (newOperand, castValue);
1154
1145
newOperand = castValue;
@@ -1309,7 +1300,7 @@ Block *ConversionPatternRewriterImpl::applySignatureConversion(
1309
1300
}
1310
1301
if (legalOutputType && legalOutputType != origArgType) {
1311
1302
Value targetMat = buildUnresolvedMaterialization (
1312
- MaterializationKind::Target, computeInsertPoint (argMat),
1303
+ MaterializationKind::Target, OpBuilder::InsertPoint::after (argMat),
1313
1304
origArg.getLoc (), /* inputs=*/ argMat, /* outputType=*/ legalOutputType,
1314
1305
/* originalType=*/ origArgType, converter);
1315
1306
mapping.map (argMat, targetMat);
@@ -1401,7 +1392,7 @@ void ConversionPatternRewriterImpl::notifyOpReplaced(Operation *op,
1401
1392
1402
1393
// Materialize a replacement value "out of thin air".
1403
1394
newValue = buildUnresolvedMaterialization (
1404
- MaterializationKind::Source, computeInsertPoint (result),
1395
+ MaterializationKind::Source, OpBuilder::InsertPoint::after (result),
1405
1396
result.getLoc (), /* inputs=*/ ValueRange (),
1406
1397
/* outputType=*/ result.getType (), /* originalType=*/ Type (),
1407
1398
currentTypeConverter);
@@ -2596,7 +2587,7 @@ void OperationConverter::finalize(ConversionPatternRewriter &rewriter) {
2596
2587
Value newValue = rewriterImpl.mapping .lookupOrNull (originalValue);
2597
2588
assert (newValue && " replacement value not found" );
2598
2589
Value castValue = rewriterImpl.buildUnresolvedMaterialization (
2599
- MaterializationKind::Source, computeInsertPoint (newValue),
2590
+ MaterializationKind::Source, OpBuilder::InsertPoint::after (newValue),
2600
2591
originalValue.getLoc (),
2601
2592
/* inputs=*/ newValue, /* outputType=*/ originalValue.getType (),
2602
2593
/* originalType=*/ Type (), converter);
0 commit comments