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]: fix branch eliminator cases in sccp #4003

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented May 5, 2024

What I did

How I did it

How to verify it

Commit message

in sccp, when the operand of `jnz`, `djmp` or `assert` is already an
`IRLiteral` (this is most easily seen by disabling the IRnode branch
eliminator), the compiler will panic. this commit fixes the bug, and
refactor some commonly used code into helper functions.

Description for the changelog

Cute Animal Picture

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

in sccp, when the operand of `jnz` or `assert` is already an IRLiteral
(this is most easily seen by disabling the IRnode branch eliminator),
the compiler will panic.
@charles-cooper charles-cooper requested a review from harkal May 5, 2024 14:31
Copy link
Collaborator

@harkal harkal left a comment

Choose a reason for hiding this comment

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

djmp is also "vulnerable" to passing a literal.

I think a better solution would be to never arrive here with literals in conditions. This will allow the algorithm to remain pure. A better place might be the remove_unreachable_blocks pass.

@charles-cooper
Copy link
Member Author

how about literals inside of assertions?

@codecov-commenter
Copy link

codecov-commenter commented May 7, 2024

Codecov Report

Attention: Patch coverage is 96.96970% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 89.91%. Comparing base (93147be) to head (e39076a).

❗ Current head e39076a differs from pull request most recent head b02e098. Consider uploading reports for the commit b02e098 to get more accurate results

Files Patch % Lines
vyper/venom/passes/sccp/sccp.py 96.29% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4003      +/-   ##
==========================================
- Coverage   90.78%   89.91%   -0.87%     
==========================================
  Files         105      103       -2     
  Lines       15248    14915     -333     
  Branches     3362     3303      -59     
==========================================
- Hits        13843    13411     -432     
- Misses        966     1053      +87     
- Partials      439      451      +12     

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

charles-cooper and others added 2 commits May 7, 2024 15:27
* changed the index type of lattice to `IRVariable` (it should only
  have variables)
* add getter/setter methods that also check types to cache future
  regretions
* add `_eval_lattice_with_op()` to evaluate the lattice with an operant
* revert `_eval()` changes
* unify the handling of `store`
@charles-cooper
Copy link
Member Author

i'm going to revert the changes to exp eval and the CI pipelines in order to keep this PR more "pure". will open those in a separate PR

@charles-cooper charles-cooper enabled auto-merge (squash) May 8, 2024 15:39
@charles-cooper charles-cooper merged commit 35996f1 into vyperlang:master May 8, 2024
150 checks passed
@charles-cooper charles-cooper deleted the fix/venom-branch-elimination-literal branch May 8, 2024 15:42
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.

None yet

4 participants