Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix[venom]: add make_ssa pass after algebraic optimizations #4292

Merged
merged 15 commits into from
Oct 16, 2024

Conversation

harkal
Copy link
Collaborator

@harkal harkal commented Oct 11, 2024

What I did

Resolve #4288 caused by unnormalised code after store elimination manipulating phi instructions. Added a test case for it.

How I did it

Perform a MakeSSA pass after algebraic optimizations

How to verify it

Commit message

This commit adds a `MakeSSA` pass after algebraic optimisations. Makes
`StoreElimination` pass skip `phi` instructions and adds a test case
that would fail without this step. The `MakeSSA` pass here results in
smaller code so we are keeping it in for now.

Resolves GH issue #4288

Description for the changelog

Cute Animal Picture

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

@harkal harkal changed the title fix[venom]: Convert to SSA after algebraic optimizations fix[venom]: convert to SSA after algebraic optimizations Oct 11, 2024
@harkal harkal requested a review from charles-cooper October 11, 2024 17:13
@harkal harkal marked this pull request as ready for review October 11, 2024 17:15
@charles-cooper
Copy link
Member

How do we get unnormalized code after algebraic optimizations?

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 10.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 50.86%. Comparing base (039d369) to head (674b203).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
vyper/venom/passes/sccp/sccp.py 0.00% 3 Missing ⚠️
vyper/venom/passes/store_elimination.py 25.00% 3 Missing ⚠️
vyper/venom/analysis/cfg.py 0.00% 2 Missing ⚠️
vyper/venom/__init__.py 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (039d369) and HEAD (674b203). Click for more details.

HEAD has 170 uploads less than BASE
Flag BASE (039d369) HEAD (674b203)
187 17
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4292       +/-   ##
===========================================
- Coverage   89.39%   50.86%   -38.54%     
===========================================
  Files         112      112               
  Lines       15923    15927        +4     
  Branches     2693     2694        +1     
===========================================
- Hits        14235     8101     -6134     
- Misses       1192     7179     +5987     
- Partials      496      647      +151     

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

@charles-cooper
Copy link
Member

since MakeSSA is expensive, i think this solution works, but is not ideal. i'm ok with merging it as a kludge, but i think we want to leave a note to circle back and figure out why we are being taken out of ssa.

Copy link
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

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

there's something strange going on -- i checked if we are still in SSA form after the store elim, simplifyCFG and algebraic optimization passes and we still are -- seems something else is going on

Copy link
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

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

magic! 🪄

@charles-cooper charles-cooper changed the title fix[venom]: convert to SSA after algebraic optimizations fix[venom]: add make_ssa pass after algebraic optimizations Oct 16, 2024
@charles-cooper charles-cooper changed the title fix[venom]: add make_ssa pass after algebraic optimizations fix[venom]: add make_ssa pass after algebraic optimizations Oct 16, 2024
@charles-cooper charles-cooper enabled auto-merge (squash) October 16, 2024 16:07
@charles-cooper charles-cooper merged commit b3ea663 into vyperlang:master Oct 16, 2024
157 of 159 checks passed
@harkal harkal deleted the fix/make_ssa_after_algebraic branch October 16, 2024 18:54
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.

Venom bug: IndexError: list index out of range
2 participants