Skip to content

feat[venom]: add common subexpression elimination#4241

Merged
charles-cooper merged 200 commits intovyperlang:masterfrom
HodanPlodky:feat/cse
Apr 25, 2025
Merged

feat[venom]: add common subexpression elimination#4241
charles-cooper merged 200 commits intovyperlang:masterfrom
HodanPlodky:feat/cse

Conversation

@HodanPlodky
Copy link
Copy Markdown
Collaborator

@HodanPlodky HodanPlodky commented Sep 16, 2024

What I did

Created common subexpression elimination pass

How I did it

Created available expression analysis and common subexpressions elimination pass. The available expression analysis is done with consideration to effects which heavy inspired by multidimensional fencing.

How to verify it

Created tests

Commit message

This commit implements available expression analysis and common
subexpression (CSE) elimination pass. The available expression
analysis detects all the expression that are available at particular
instruction. The CSE elimination pass uses this information to replace
instruction with results that are already computed, if available.

Cute Animal Picture

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

class _Expression:
first_inst : IRInstruction
opcode: str
operands : list[IROperand]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks like this can be IROperand | _Expression

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 17, 2024

Codecov Report

Attention: Patch coverage is 93.47079% with 19 lines in your changes missing coverage. Please review.

Project coverage is 92.44%. Comparing base (b635696) to head (93a82ff).
Report is 70 commits behind head on master.

Files with missing lines Patch % Lines
vyper/venom/analysis/available_expression.py 91.91% 15 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4241      +/-   ##
==========================================
+ Coverage   92.42%   92.44%   +0.01%     
==========================================
  Files         125      127       +2     
  Lines       18017    18308     +291     
  Branches     3110     3174      +64     
==========================================
+ Hits        16653    16925     +272     
- Misses        931      946      +15     
- Partials      433      437       +4     

☔ 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.

Copy link
Copy Markdown
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.

awesome! please write up a commit message and ping me when you have given a final look over and think it's ready to merge

charles-cooper and others added 8 commits April 22, 2025 14:34
we will explore performance improvements in a followup PR

Revert "comment"

This reverts commit 326f317.

Revert "add a comment"

This reverts commit 2f46fab.

Revert "lru_cache flag operations"

This reverts commit 186d373.

Revert "copy is shallow"

This reverts commit c5b8621.

Revert "less copies"

This reverts commit 90165e0.
@charles-cooper charles-cooper changed the title feat[venom]: common subexpression elimination pass feat[venom]: add common subexpression elimination Apr 24, 2025
@charles-cooper charles-cooper enabled auto-merge (squash) April 24, 2025 19:26
@charles-cooper charles-cooper merged commit f2cb6c2 into vyperlang:master Apr 25, 2025
161 checks passed
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