Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): Type inference rewriter: Handle return-like operations…
… correctly Return-like operations require special treatment by the type inference rewriter, since their operand types are both tied to the result types of their producers and to result types of their parent operations. The inference scheme for ordinary operations, in which the initial local inference state is composed of the operand types of the rewritten producers and the old types of related operations before rewriting is insufficient, since this may result in a mismatch between the inferred types and the actual types of the already rewritten parent operation. Until now, precedence of the new result types of the parent operation has been implemented by simply designating these types as the operand types of a return-like operation. However, while this works as intended for return-like operations, which simply forward values (e.g., `func.return`), this creates invalid IR for other return-like operations (e.g., `tensor.yield`). This change implements precedence of the result types of the parent operation of a return-like operation by adding the return types of the already rewritten parent operation to the initial local inference state before final invocation of type inference.
- Loading branch information