[TIRx] Generalize expression functor signatures#19931
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the SizeVar and SizeVarNode classes, unifying symbolic variables under Var and VarNode. It also updates ExprFunctor and its subclasses to operate on Expr instead of PrimExpr to allow visiting and mutating general expressions. Additionally, BlockBuilder in Relax is updated to track active scopes and blocks to safely unwind them on exceptional exits. The reviewer identified a potential issue in _exit_function_scope where exceptions during block or scope finalization could skip subsequent cleanup steps, and suggested using a try...finally block to ensure robust cleanup.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
a4ba091 to
9d02d61
Compare
5c57f32 to
c232afb
Compare
Unify TIRX expression traversal on the shared Expr surface. Expose one generalized statement hook while keeping primitive reconstruction behind checked VisitPrimExpr boundaries.
c232afb to
b8e34e0
Compare
Expression unification gives TIRX a shared
Exprsurface, but its visitor and mutator APIs still expose primitive-only signatures. That mismatch prevents general expressions from flowing through the existing traversal structure and leaves statement traversal with overlapping customization hooks.This refactor generalizes the existing
ExprFunctor,ExprVisitor, andExprMutatorsignatures in place to accept and returnExpr. Statement visitors and mutators expose a single virtualVisitExpr(const Expr&)hook, while primitive statement reconstruction uses a non-virtual checkedVisitPrimExprhelper so invalid narrowing fails at the boundary. Public pre-order and post-order traversal entry points accept generalExprroots.The existing specialization, vtable, dispatch registration, and class structure remain intact; the change adds no parallel functor, fallback dispatcher, or alternate implementation path.