Skip to content

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Mar 11, 2025

What I did

How I did it

How to verify it

Commit message

generalize load elimination across basic blocks. use a lattice to
propagate values across basic block boundaries. insert phi nodes where
the value of the load depends on the entry block.

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 May 20, 2025 12:33
def _process_bb(self, bb, eff, load_opcode, store_opcode):
# not really a lattice even though it is not really inter-basic block;
# we may generalize in the future
self._lattice = {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it necessary for this to be field? Could it be just local?

Copy link
Member Author

Choose a reason for hiding this comment

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

could just be local, but it needs to be passed to callees _handle_load and _handle_store

Copy link
Member Author

Choose a reason for hiding this comment

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

i just tried it locally, and imo it makes the code harder to follow because you have to trace how it's being passed to the callees

elif inst.opcode == load_opcode:
self._handle_load(inst)

for k, v in self._lattice.items():
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is necessary for possible phi insertion right? or is there any other reason?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, just for phi instructions, because phi instructions can only accept variables (which are defined in the predecessor block)

Copy link

codecov bot commented Sep 3, 2025

Codecov Report

❌ Patch coverage is 96.47887% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.21%. Comparing base (709d50e) to head (72b4b3f).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
vyper/venom/passes/load_elimination.py 96.40% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4512      +/-   ##
==========================================
- Coverage   93.21%   93.21%   -0.01%     
==========================================
  Files         136      136              
  Lines       19203    19299      +96     
  Branches     3295     3316      +21     
==========================================
+ Hits        17901    17989      +88     
- Misses        884      888       +4     
- Partials      418      422       +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.

@charles-cooper charles-cooper enabled auto-merge (squash) October 1, 2025 02:51
@charles-cooper charles-cooper merged commit 8bcfa6a into vyperlang:master Oct 1, 2025
160 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.

3 participants