Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Relax][Bugfix] Provide the full Expr to pattern-match rewriter (#16828)
* [Relax][Bugfix] Provide the full Expr to pattern-match rewriter This resolves a bug that was introduced in #16732. If a rewriter function returned a no-op, and the pattern-match continued, then the `matches` provided to the rewriter function in subsequent calls would contain a variable to which the matched expression was bound, not the matched expression itself. (e.g. For a match of `C = R.add(A,B)`, passing `C` to the rewriter instead of `R.add(A,B)`.) This bug was caused by incorrect re-wrapping of `OrPattern` in `ExprPatternRewriter`. Prior to #16732, all pattern-match results were populated by `ExtractMatchExpr`, and contained the result after applying `TryGetValOfVar`. When re-wrapping the result of an `OrPattern`, #16732 populated the additional matches with the result before applying `TryGetValOfVar`. This commit fixes the bug by applying `TryGetValOfVar`. * Update with PR link of bugfix
- Loading branch information