[Mlir-commits] [mlir] [mlir][Transforms] Fix crash in `reconcile-unrealized-casts` (PR #158067)

Mehdi Amini llvmlistbot at llvm.org
Fri Sep 12 04:47:41 PDT 2025


================
@@ -3303,20 +3306,15 @@ LogicalResult OperationConverter::convertOperations(ArrayRef<Operation *> ops) {
 // Reconcile Unrealized Casts
 //===----------------------------------------------------------------------===//
 
-void mlir::reconcileUnrealizedCasts(
-    ArrayRef<UnrealizedConversionCastOp> castOps,
+/// Try to reconcile all given UnrealizedConversionCastOps and store the
+/// left-over ops in `remainingCastOps` (if provided). See documentation in
+/// DialectConversion.h for more details.
+template <typename RangeT>
+static void reconcileUnrealizedCastsImpl(
+    RangeT castOps, function_ref<bool(UnrealizedConversionCastOp)> isCastOpFn,
----------------
joker-eph wrote:

```suggestion
/// Try to reconcile all given UnrealizedConversionCastOps and store the
/// left-over ops in `remainingCastOps` (if provided). See documentation in
/// DialectConversion.h for more details.
/// The `isCastOpOfInterestFn` is used to filter the cast ops to proceed: the algorithm may
/// visit an operand (or user) which is a cast op, but will not try to reconcile it if not in the
/// filtered set.
template <typename RangeT>
static void reconcileUnrealizedCastsImpl(
    RangeT castOps, function_ref<bool(UnrealizedConversionCastOp)> isCastOpOfInterestFn,
```

https://github.com/llvm/llvm-project/pull/158067


More information about the Mlir-commits mailing list