Skip to content

Conversation

@eytan-starkware
Copy link
Contributor

@eytan-starkware eytan-starkware commented Jan 28, 2026

Summary

Refactored the block reorganization code in the lowering phase to use the new dataflow analysis framework. This PR replaces the old BackAnalysis with DataflowBackAnalysis and updates the TopSortContext to implement the DataflowAnalyzer trait instead of Analyzer. The implementation now follows a more structured approach with dedicated methods for handling different types of edges and transfers.


Type of change

Please check one:

  • Bug fix (fixes incorrect behavior)
  • New feature
  • Performance improvement
  • Documentation change with concrete technical impact
  • Style, wording, formatting, or typo-only change

Why is this change needed?

This change is part of the ongoing effort to standardize the dataflow analysis framework in the compiler. By migrating the block reorganization code to use the new dataflow analysis infrastructure, we ensure consistency across the codebase and make future maintenance easier.


What was the behavior or documentation before?

Previously, the block reorganization logic used the older BackAnalysis system with custom visitor methods for different statement types. The analysis was less structured and had separate methods for handling different block end types.


What is the behavior or documentation after?

Now the code uses the more structured DataflowBackAnalysis framework with clear separation between initialization, transfer functions, and edge handling. The implementation is more consistent with other parts of the compiler that use the dataflow analysis framework.


Additional context

This refactoring maintains the same functionality while aligning with the new analysis infrastructure. The changes primarily affect how the analysis is structured rather than changing the actual block reorganization logic.

Refactors reorganize_blocks.rs to use the new DataflowAnalyzer trait.
This is a work-in-progress - the analyzer state (old_block_rev_order,
incoming_gotos, can_be_merged, remappings_ctx) needs to be moved into
the Info type so it flows through the analysis properly.

Currently broken - ctx is consumed by the analysis but used afterwards.
@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

eytan-starkware commented Jan 28, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@eytan-starkware eytan-starkware marked this pull request as ready for review January 28, 2026 15:34
@eytan-starkware eytan-starkware changed the base branch from eytan_graphite/_refactor_moving_unsafe_panic_optimization_into_new_dataflow_format to graphite-base/9558 January 29, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants