diff options
author | Matthias Springer <me@m-sp.org> | 2025-08-07 08:41:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-07 08:41:28 +0200 |
commit | 71832a3139b454f8e714ff54e8bb0ea12dc095f5 (patch) | |
tree | 0f1808f2b35beb791e4da2cb0ed4e31b2ca165d4 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 0a72e6ddac0f9154b806c40992d1616fa86957d8 (diff) | |
download | llvm-71832a3139b454f8e714ff54e8bb0ea12dc095f5.zip llvm-71832a3139b454f8e714ff54e8bb0ea12dc095f5.tar.gz llvm-71832a3139b454f8e714ff54e8bb0ea12dc095f5.tar.bz2 |
[mlir][Transforms] Make lookup without type converter unambiguous (#151747)
When a conversion pattern is initialized without a type converter, the
driver implementation currently looks up the most recently mapped value.
This is undesirable because the most recently mapped value could be a
materialization. I.e., the type of the value being looked up could
depend on which other patterns have run before. Such an implementation
makes the type conversion infrastructure fragile and unpredictable.
The current implementation also contradicts the documentation in the
markdown file. According to that documentation, the values provided by
the adaptor should match the types of the operands of the match
operation when running without a type converter. This mechanism is not
desirable, either, for two reasons:
1. Some patterns have started to rely on receiving the most recently
mapped value. Changing the behavior to the documented behavior will
cause regressions. (And there would be no easy way to fix those without
forcing the use of a type converter or extending the `getRemappedValue`
API.)
2. It is more useful to receive the most recently mapped value. A value
of the original operand type can be retrieved by using the operand of
the matched operation. The adaptor is not needed at all in that case.
To implement the new behavior, materializations are now annotated with a
marker attribute. The marker is needed because not all
`unrealized_conversion_cast` ops are materializations that act as "pure
type conversions". E.g., when erasing an operation, its results are
mapped to newly-created "out-of-thin-air values", which are
materializations (with no input) that should be treated like regular
replacement values during a lookup. This marker-based lookup strategy is
also compatible with the One-Shot Dialect Conversion implementation
strategy, which does not utilize the mapping infrastructure anymore and
queries all necessary information by examining the IR.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions