[Mlir-commits] [mlir] [mlir][Transforms] Fix crash in `reconcile-unrealized-casts` (PR #158067)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Sep 12 06:20:28 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- mlir/include/mlir/Transforms/DialectConversion.h mlir/lib/Transforms/Utils/DialectConversion.cpp
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index d228f403b..3a644c6b5 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -3309,12 +3309,13 @@ LogicalResult OperationConverter::convertOperations(ArrayRef<Operation *> ops) {
/// 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.
+/// 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,
+ RangeT castOps,
+ function_ref<bool(UnrealizedConversionCastOp)> isCastOpOfInterestFn,
SmallVectorImpl<UnrealizedConversionCastOp> *remainingCastOps) {
// A worklist of cast ops to process.
SetVector<UnrealizedConversionCastOp> worklist(llvm::from_range, castOps);
@@ -3383,13 +3384,14 @@ static void reconcileUnrealizedCastsImpl(
// Find all alive cast ops.
for (UnrealizedConversionCastOp op : castOps) {
- // The op may have been marked live already as being an operand of another live cast op.
+ // The op may have been marked live already as being an operand of another
+ // live cast op.
if (liveOps.contains(op.getOperation()) continue;
// If any of the users is not a cast op, mark the current op (and its
// input ops) as live.
if (llvm::any_of(op->getUsers(), [&](Operation *user) {
- auto castOp = dyn_cast<UnrealizedConversionCastOp>(user);
- return !castOp || !isCastOpFn(castOp);
+ auto castOp = dyn_cast<UnrealizedConversionCastOp>(user);
+ return !castOp || !isCastOpFn(castOp);
}))
markOpLive(op);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/158067
More information about the Mlir-commits
mailing list