@@ -53,16 +53,6 @@ static void logFailure(llvm::ScopedPrinter &os, StringRef fmt, Args &&...args) {
5353 });
5454}
5555
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-
6656// ===----------------------------------------------------------------------===//
6757// ConversionValueMapping
6858// ===----------------------------------------------------------------------===//
@@ -1147,8 +1137,9 @@ LogicalResult ConversionPatternRewriterImpl::remapValues(
11471137 // that the value was replaced with a value of different type and no
11481138 // source materialization was created yet.
11491139 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,
11521143 /* originalType=*/ origType, currentTypeConverter);
11531144 mapping.map (newOperand, castValue);
11541145 newOperand = castValue;
@@ -1309,7 +1300,7 @@ Block *ConversionPatternRewriterImpl::applySignatureConversion(
13091300 }
13101301 if (legalOutputType && legalOutputType != origArgType) {
13111302 Value targetMat = buildUnresolvedMaterialization (
1312- MaterializationKind::Target, computeInsertPoint (argMat),
1303+ MaterializationKind::Target, OpBuilder::InsertPoint::after (argMat),
13131304 origArg.getLoc (), /* inputs=*/ argMat, /* outputType=*/ legalOutputType,
13141305 /* originalType=*/ origArgType, converter);
13151306 mapping.map (argMat, targetMat);
@@ -1401,7 +1392,7 @@ void ConversionPatternRewriterImpl::notifyOpReplaced(Operation *op,
14011392
14021393 // Materialize a replacement value "out of thin air".
14031394 newValue = buildUnresolvedMaterialization (
1404- MaterializationKind::Source, computeInsertPoint (result),
1395+ MaterializationKind::Source, OpBuilder::InsertPoint::after (result),
14051396 result.getLoc (), /* inputs=*/ ValueRange (),
14061397 /* outputType=*/ result.getType (), /* originalType=*/ Type (),
14071398 currentTypeConverter);
@@ -2596,7 +2587,7 @@ void OperationConverter::finalize(ConversionPatternRewriter &rewriter) {
25962587 Value newValue = rewriterImpl.mapping .lookupOrNull (originalValue);
25972588 assert (newValue && " replacement value not found" );
25982589 Value castValue = rewriterImpl.buildUnresolvedMaterialization (
2599- MaterializationKind::Source, computeInsertPoint (newValue),
2590+ MaterializationKind::Source, OpBuilder::InsertPoint::after (newValue),
26002591 originalValue.getLoc (),
26012592 /* inputs=*/ newValue, /* outputType=*/ originalValue.getType (),
26022593 /* originalType=*/ Type (), converter);
0 commit comments