Skip to content

[refactor, fix] Dataflow Analysis Interface and Lattice Interface - #22

Open
yhteoh wants to merge 31 commits into
mainfrom
fix_maplattice
Open

yhteoh wants to merge 31 commits into
mainfrom
fix_maplattice

Conversation

@yhteoh

@yhteoh yhteoh commented Sep 16, 2026

Copy link
Copy Markdown
Contributor
  • Please check if the PR fulfills these requirements
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    fix

  • What is the current behavior? (You can also link to an open issue here)

  • Uses LatticeBottom as default value of unassigned key
  • CFG after CFGBlockAccumulator blocks ids are not consecutive
  • No control over initial state
  • No max number of iterations in DataflowAnalysis
  • DataflowAnalysis.analyze takes in merge_function, even though merge_function is determined by the analysis
  • CFGBlock.edge_labels in form node id to label
  • BackwardDataflowAnalysis flips in_states and out_states when returning
  • maplattice incorrect type hints
  • What is the new behavior (if this is a feature change)?
  • lattice changes

    • maplattice able to determine behavior for undefined keys, one of [flexible, top, bottom, strict]
    • Refactor maplattice by enabling caching and implementing a base class MapLattice for dynamically generated subclasses to inherit from
    • Added LatticeMeta to manage singleton instances of Lattice
  • dataflow changes

    • Added max iterations for DataflowAnalysis
    • Added abtractmethod for DataflowAnalysis for default initial state based on graph
    • Added argument to DataflowAnalysis.analyze to use an initial state
    • Added argument to determine max number of iterations for DataflowAnalysis
    • Added abstractmethod DataflowAnalysis.merge to specify merge function to use instead of as an argument to DataflowAnalysis.analyze
    • Fixed BackwardDataflowAnalysis flips to return the in_states and out_states correctly`
    • DataflowResult now contains the DataflowAnalysis used to generate it
  • cfg changes

    • use sets for CFGBlock.succs and CFGBlock.preds
    • Reversed CFGBlock.edge_labels to be of form label to node id
    • Add tags for CFGBlock
    • Added RelabelCFGBlocks to relabel block ids such that they are consecutive
  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
    major
  • take note of new default behavior of maplattice operations
  • major change to DataflowAnalysis interface
  • Other information:

@yhteoh
yhteoh force-pushed the fix_maplattice branch 2 times, most recently from d211b4a to 6a4525d Compare September 17, 2026 17:01
… specifying initial state for analyze, use abstract method merge to specify merge function instead of argument to analyze
…nd result as the out_state for both backwards and forwards. Cleaned up dataflow interface with based on this
…ngleton instances for Lattices, Added MapLattice as base class for dynamic class generation in maplattice and added caching to maplattice, changed maplattice storage of element lattice, now stored as instance instead of class
…oundary and result to in_states and out_states in DataflowAnalysis.analyze, optimize DataflowAnalysis.analyze
@yhteoh yhteoh changed the title [fix] maplattice unassigned key [refactor, fix] Dataflow Analysis Interface and Lattice Interface Sep 19, 2026
@yhteoh yhteoh self-assigned this Sep 19, 2026
@yhteoh yhteoh added bug Something isn't working enhancement New feature or request labels Sep 19, 2026
@yhteoh
yhteoh force-pushed the fix_maplattice branch 2 times, most recently from a5a738c to 7d8eae3 Compare September 19, 2026 22:20
@yhteoh
yhteoh force-pushed the fix_maplattice branch 2 times, most recently from 06a2507 to 15fe806 Compare September 20, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant