[ARITH][TIR] Track positive loop extents in analyzer visitors#19927
[ARITH][TIR] Track positive loop extents in analyzer visitors#19927tlopex wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates IRMutatorWithAnalyzer and IRVisitorWithAnalyzer to register a constraint that the loop extent is positive (extent > 0) when visiting a loop's body, allowing for better simplification of expressions inside the loop. A test case is added to verify this behavior. One issue was identified in IRMutatorWithAnalyzer::VisitStmt_ where the constraint is registered using the original op->extent instead of the mutated extent, which can make the constraint ineffective if the extent expression is mutated. It is recommended to use the mutated extent instead.
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.
eaf5821 to
5f90ee3
Compare
|
cc @LeiWang1999 |
|
cc @LJC00118 |
|
LGTM! |
|
@tvm-bot run |
|
@tvm-bot rerun |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/28610487289 Detailswith response |
|
|
This PR updates
IRMutatorWithAnalyzerandIRVisitorWithAnalyzerto add the constraintloop_extent > 0while visiting aForNodebody.If execution reaches the loop body, the loop must have at least one iteration, so the body context can safely assume the extent is positive. The constraint is scoped only to the loop body, leaving the loop header expressions (
min,extent,step) outside of this assumption.