Skip to content

Commit 6183b1d

Browse files
fix
1 parent fa3bebd commit 6183b1d

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

mlir/lib/Transforms/Utils/DialectConversion.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3309,12 +3309,13 @@ LogicalResult OperationConverter::convertOperations(ArrayRef<Operation *> ops) {
33093309
/// Try to reconcile all given UnrealizedConversionCastOps and store the
33103310
/// left-over ops in `remainingCastOps` (if provided). See documentation in
33113311
/// DialectConversion.h for more details.
3312-
/// The `isCastOpOfInterestFn` is used to filter the cast ops to proceed: the algorithm may
3313-
/// visit an operand (or user) which is a cast op, but will not try to reconcile it if not in the
3314-
/// filtered set.
3312+
/// The `isCastOpOfInterestFn` is used to filter the cast ops to proceed: the
3313+
/// algorithm may visit an operand (or user) which is a cast op, but will not
3314+
/// try to reconcile it if not in the filtered set.
33153315
template <typename RangeT>
33163316
static void reconcileUnrealizedCastsImpl(
3317-
RangeT castOps, function_ref<bool(UnrealizedConversionCastOp)> isCastOpOfInterestFn,
3317+
RangeT castOps,
3318+
function_ref<bool(UnrealizedConversionCastOp)> isCastOpOfInterestFn,
33183319
SmallVectorImpl<UnrealizedConversionCastOp> *remainingCastOps) {
33193320
// A worklist of cast ops to process.
33203321
SetVector<UnrealizedConversionCastOp> worklist(llvm::from_range, castOps);
@@ -3375,21 +3376,23 @@ static void reconcileUnrealizedCastsImpl(
33753376
// Successfully inserted: process reachable input cast ops.
33763377
for (Value v : op->getOperands())
33773378
if (auto castOp = v.getDefiningOp<UnrealizedConversionCastOp>())
3378-
if (isCastOpFn(castOp))
3379+
if (isCastOpOfInterestFn(castOp))
33793380
worklist.push_back(castOp);
33803381
}
33813382
}
33823383
};
33833384

33843385
// Find all alive cast ops.
33853386
for (UnrealizedConversionCastOp op : castOps) {
3386-
// The op may have been marked live already as being an operand of another live cast op.
3387-
if (liveOps.contains(op.getOperation()) continue;
3387+
// The op may have been marked live already as being an operand of another
3388+
// live cast op.
3389+
if (liveOps.contains(op.getOperation()))
3390+
continue;
33883391
// If any of the users is not a cast op, mark the current op (and its
33893392
// input ops) as live.
33903393
if (llvm::any_of(op->getUsers(), [&](Operation *user) {
33913394
auto castOp = dyn_cast<UnrealizedConversionCastOp>(user);
3392-
return !castOp || !isCastOpFn(castOp);
3395+
return !castOp || !isCastOpOfInterestFn(castOp);
33933396
}))
33943397
markOpLive(op);
33953398
}

0 commit comments

Comments
 (0)