Skip to content
Commit 0c7f3d6c authored by Jakub Kuderski's avatar Jakub Kuderski
Browse files

[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
parent f2f37557
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment