Skip to content

refactor[venom]: extract liveness and cfg data structures#4595

Merged
charles-cooper merged 21 commits intovyperlang:masterfrom
charles-cooper:refactor/venom/liveness-and-cfg
Apr 27, 2025
Merged

refactor[venom]: extract liveness and cfg data structures#4595
charles-cooper merged 21 commits intovyperlang:masterfrom
charles-cooper:refactor/venom/liveness-and-cfg

Conversation

@charles-cooper
Copy link
Copy Markdown
Member

@charles-cooper charles-cooper commented Apr 24, 2025

What I did

How I did it

How to verify it

Commit message

this commit removes the data structures related to liveness and
the CFG from venom instructions/basic blocks. this makes it so that
the lifetime of the data structures is tied to the lifetime of the
analyses, rather than needing to invalidate on the instructions/basic
blocks, making them more "pure".

it also starts a pattern of deleting attributes from analyses at
invalidation, making it so that if we accidentally try to access
analyses that have been invalidated, an ugly `AttributeError` is
thrown.

misc/refactor:
- clean up some type signatures

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@charles-cooper charles-cooper marked this pull request as ready for review April 24, 2025 13:33
@charles-cooper charles-cooper requested review from HodanPlodky and harkal and removed request for harkal April 24, 2025 13:33
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 25, 2025

Codecov Report

❌ Patch coverage is 95.78544% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.43%. Comparing base (5fe3d2e) to head (4f12bdd).
⚠️ Report is 65 commits behind head on master.

Files with missing lines Patch % Lines
vyper/venom/function.py 62.50% 2 Missing and 1 partial ⚠️
vyper/venom/passes/simplify_cfg.py 94.33% 1 Missing and 2 partials ⚠️
vyper/venom/analysis/analysis.py 83.33% 1 Missing and 1 partial ⚠️
vyper/venom/analysis/liveness.py 94.28% 1 Missing and 1 partial ⚠️
vyper/venom/analysis/mem_ssa.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4595      +/-   ##
==========================================
- Coverage   92.43%   92.43%   -0.01%     
==========================================
  Files         127      127              
  Lines       18327    18353      +26     
  Branches     3179     3178       -1     
==========================================
+ Hits        16941    16965      +24     
  Misses        947      947              
- Partials      439      441       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

"""
Compute liveness information for each instruction in the function.
"""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cfg: CFGAnalysis

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I more similar things should I create a PR for that quickly

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRVariable

if TYPE_CHECKING:
from vyper.venom.context import IRContext

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IRContext' may not be defined if module
vyper.venom.context
is imported before module
vyper.venom.function
, as the
definition
of IRContext occurs after the cyclic
import
of vyper.venom.function.
'IRContext' may not be defined if module
vyper.venom.context
is imported before module
vyper.venom.function
, as the
definition
of IRContext occurs after the cyclic
import
of vyper.venom.function.
@charles-cooper charles-cooper merged commit 642da76 into vyperlang:master Apr 27, 2025
161 of 162 checks passed
@charles-cooper charles-cooper deleted the refactor/venom/liveness-and-cfg branch April 27, 2025 14:05
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.

4 participants