[all-commits] [llvm/llvm-project] 0c7f3d: [mlir] Allow to specify target type in `convertType`
Jakub Kuderski via All-commits
all-commits at lists.llvm.org
Wed Apr 19 10:54:48 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0c7f3d6c39d7dd7d240854ac347a801d62dc938b
https://github.com/llvm/llvm-project/commit/0c7f3d6c39d7dd7d240854ac347a801d62dc938b
Author: Jakub Kuderski <kubak at google.com>
Date: 2023-04-19 (Wed, 19 Apr 2023)
Changed paths:
M mlir/include/mlir/Transforms/DialectConversion.h
M mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp
M mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp
Log Message:
-----------
[mlir] Allow to specify target type in `convertType`
Add a new helper function for the type converter that takes care of
casting to the target type.
This is to avoid bugs where an incorrect cast function is used after
type conversion, e.g., `dyn_cast` or `cast`. These are not guaranteed to
work when type conversion fails, or when type conversion succeeds but
the provided type converted returned a type that a conversion pattern
did not expect.
I saw this being an issue in some SPIR-V passes and in mlir-hlo.
Exercise the new function in a couple of passes. As a side-effect, this
also made the code more concise.
Reviewed By: rriddle, mehdi_amini
Differential Revision: https://reviews.llvm.org/D148725
More information about the All-commits
mailing list