[all-commits] [llvm/llvm-project] dfe30e: [mlir][Conversion] Generalize and fix crash in `re...
Matthias Springer via All-commits
all-commits at lists.llvm.org
Sun Jun 16 05:15:37 PDT 2024
Branch: refs/heads/users/matthias-springer/reconcile_unrealized_casts
Home: https://github.com/llvm/llvm-project
Commit: dfe30eea88f82905fcb2dcb9af0d86f5e234efcf
https://github.com/llvm/llvm-project/commit/dfe30eea88f82905fcb2dcb9af0d86f5e234efcf
Author: Matthias Springer <mspringer at nvidia.com>
Date: 2024-06-16 (Sun, 16 Jun 2024)
Changed paths:
M mlir/include/mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h
M mlir/lib/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.cpp
M mlir/test/Conversion/FuncToLLVM/calling-convention.mlir
R mlir/test/Conversion/ReconcileUnrealizedCasts/reconcile-unrealized-casts-failure.mlir
M mlir/test/Conversion/ReconcileUnrealizedCasts/reconcile-unrealized-casts.mlir
M mlir/test/Dialect/LLVM/lower-to-llvm-e2e-with-target-tag.mlir
M mlir/test/Dialect/LLVM/lower-to-llvm-e2e-with-top-level-named-sequence.mlir
Log Message:
-----------
[mlir][Conversion] Generalize and fix crash in `reconcile-unrealized-casts`
This commit fixes a crash in `-reconcile-unrealized-casts` when cast ops have multiple operands:
```
DialectConversion.cpp:1583: virtual void mlir::ConversionPatternRewriter::replaceOp(mlir::Operation *, mlir::ValueRange): Assertion `op->getNumResults() == newValues.size() && "incorrect # of replacement values"' failed.
```
This commit also generalizes the pass such that more ops are folded. In particular (letters indicate types):
```
A
/ \
B C
|
A
```
Previously, such IR was not folded at all. The `A -> B -> A` type cast cycle is now folded away. (The `A -> C` cast stays in place.)
This commit also turns the pass from a dialect conversion into a simple IR walk. The pattern and its `populate` function are removed. The pattern was a (non-conversion) rewrite pattern, but used in a dialect conversion, which is generally not supported. In particular, the rewrite pattern may traverse IR that was already scheduled for erasure by the dialect conversion.
Note: Some test cases changed slightly (NFC) because the new pass implementation no longer attempts to fold ops.
Note for LLVM integration: If your pipeline uses the removed `populate` function, try to simply remove that function call. Chances are you may not need it at all. If it is in fact needed, run the `-reconcile-unrealized-casts` pass right after the pass that used to populate the pattern.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list