llvm-project/mlir/lib/Transforms/Utils
Alex Zinenko d4a53f3bfa [mlir] call target materialization more in dialect conversion
During dialect conversion, target materialization is triggered to create
cast-like operations when a type mismatch occurs between the value that
replaces a rewritten operation and the type that another operations expects as
operands processed by the type conversion. First, a dummy cast is inserted to
make sure the pattern application can proceed. The decision to trigger the
user-provided materialization hook is taken later based on the result of the
dummy cast having uses. However, it only has uses if other patterns constructed
new operations using the casted value as operand. If existing (legal)
operations use the replaced value, they may have not been updated to use the
casted value yet. The conversion infra would then delete the dummy cast first,
and then would replace the uses with now-invalid (null in the bast case) value.
When deciding whether to trigger cast materialization, check for liveness the
uses not only of the casted value, but also of all the values that it replaces.

This was discovered in the finalizing bufferize pass that cleans up
mutually-cancelling casts without touching other operations. It is not
impossible that there are other scenarios where the dialect converison infra
could produce invalid operand uses because of dummy casts erased too eagerly.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D119937
2022-02-17 10:13:23 +01:00
..
CMakeLists.txt [mlir:Transforms] Move out the remaining non-dialect independent transforms and utilities 2022-01-24 19:25:53 -08:00
ControlFlowSinkUtils.cpp [mlir:Transforms] Move out the remaining non-dialect independent transforms and utilities 2022-01-24 19:25:53 -08:00
DialectConversion.cpp [mlir] call target materialization more in dialect conversion 2022-02-17 10:13:23 +01:00
FoldUtils.cpp Fix clang-tidy issues in mlir/ (NFC) 2021-12-20 20:25:01 +00:00
GreedyPatternRewriteDriver.cpp [mlir] Remove spurious debug guard 2021-12-23 11:55:37 -08:00
InliningUtils.cpp [mlir] Make locations required when adding/creating block arguments 2022-01-19 17:35:35 -08:00
RegionUtils.cpp [mlir] Make locations required when adding/creating block arguments 2022-01-19 17:35:35 -08:00