[REFACTOR][TIR][ARITH] Phase out ControlFlowGraph, NarrowPredicateExpression, and rename Simplify to StmtSimplify#19604
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request removes the dataflow analysis functionality from the TIR simplification and no-op removal passes. Specifically, it deletes the ControlFlowGraph and NarrowPredicateExpression utilities, removes the use_dataflow_analysis configuration option, and renames the Simplify pass to StmtSimplify to reflect its statement-level scope. The review comments identify a minor grammatical typo in a docstring in stmt_simplify.cc and suggest updating a test docstring in test_tir_transform_remove_no_op.py to clarify that dataflow analysis is no longer supported.
tqchen
added a commit
to tqchen/tvm
that referenced
this pull request
May 25, 2026
…lize_device_passes The bare `tir.transform.X()` form in s_tir/pipeline.py finalize_device_passes() resolved at runtime to tvm.tirx.transform, but the post-rename module no longer exposes Simplify (it's StmtSimplify). Without this fix, calling finalize_device_passes() raises AttributeError. The CI suite did not exercise this code path, so the regression slipped through PR apache#19604. Switch all four lines to use the explicit `tirx.transform` form (already imported) and rename Simplify → StmtSimplify.
…Expression All production callers of ControlFlowGraph are gated by config flags (propagate_knowns_to_prove_conditional, propagate_knowns_to_simplify_expressions in SimplifyConfig; use_dataflow_analysis in RemoveNoOpConfig) that no standard lowering pipeline turns on. The dataflow-analysis path is effectively dead code in practice. Remove ControlFlowGraph and its sole dependent NarrowPredicateExpression entirely. Drop the config flags and their associated code paths from StmtSimplifier and NoOpRemover. The remaining simplification logic (transitively_prove_inequalities, convert_boolean_to_and_of_ors, apply_constraints_to_boolean_branches, max_simplification_steps) is unaffected. Delete the tests that exercised the removed paths.
Rename clarifies that this is statement-level simplification (distinct from
expression-level arithmetic simplifiers in src/arith/). The file names
simplify.{h,cc} become stmt_simplify.{h,cc}, and all associated C++ types,
free functions, pass functions, and FFI keys are renamed accordingly:
tirx::Simplify -> tirx::StmtSimplify, tirx::transform::Simplify ->
tirx::transform::StmtSimplify, SimplifyConfig -> StmtSimplifyConfig.
Python wrappers and all call sites are updated to match.
Fix grammatical typo in apply_constraints_to_boolean_branches docstring and update the remove_no_op test docstring to reflect that dataflow-analysis is no longer a supported option (rather than just "not used here").
…lize_device_passes The bare `tir.transform.X()` form in s_tir/pipeline.py finalize_device_passes() resolved at runtime to tvm.tirx.transform, but the post-rename module no longer exposes Simplify (it's StmtSimplify). Without this fix, calling finalize_device_passes() raises AttributeError. The CI suite did not exercise this code path, so the regression slipped through PR apache#19604. Switch all four lines to use the explicit `tirx.transform` form (already imported) and rename Simplify → StmtSimplify.
0ccd4da to
0580136
Compare
spectrometerHBH
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR cleans up technical debt in the TIR simplification machinery via two commits:
Commit 1: Phase out ControlFlowGraph and NarrowPredicateExpression
ControlFlowGraph(~2360 lines) fromsrc/tirx/analysis/— used only innon-default config paths that are no longer maintained
NarrowPredicateExpressionfromsrc/arith/— sole non-test caller wasControlFlowGraphpropagate_knowns_to_prove_conditionalandpropagate_knowns_to_simplify_expressionsfromSimplifyConfiguse_dataflow_analysisfromRemoveNoOpConfigCommit 2: Rename Simplify → StmtSimplify
src/tirx/transform/simplify.{h,cc}→stmt_simplify.{h,cc}Simplify→StmtSimplify,SimplifyConfig→StmtSimplifyConfig"tirx.Simplify"→"tirx.StmtSimplify","tirx.transform.Simplify"→"tirx.transform.StmtSimplify"arith::Analyzer::Simplify())Test plan
tests/python/tirx-transform/test_tir_transform_simplify.py— 52 tests passtests/python/tirx-transform/test_tir_transform_remove_no_op.py— 18 pass, 5 xfailtests/python/arith/— full arith test suite passestests/python/tirx-transform/— full suite: 315 passed, 8 xfailed, 1 xpassed (pre-existing vectorize failure unrelated to this change)pre-commit run --all-files— all hooks pass