-
-
Notifications
You must be signed in to change notification settings - Fork 836
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
feat[venom]: updates for algebraic opts and memmerge #4469
base: master
Are you sure you want to change the base?
feat[venom]: updates for algebraic opts and memmerge #4469
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4469 +/- ##
==========================================
+ Coverage 92.12% 92.14% +0.01%
==========================================
Files 119 119
Lines 16967 17005 +38
Branches 2872 2883 +11
==========================================
+ Hits 15631 15669 +38
Misses 918 918
Partials 418 418 ☔ View full report in Codecov by Sentry. |
vyper/venom/passes/memmerging.py
Outdated
@@ -101,6 +101,8 @@ def run_pass(self): | |||
self._handle_bb_memzero(bb) | |||
self._handle_bb(bb, "calldataload", "calldatacopy", allow_dst_overlaps_src=True) | |||
self._handle_bb(bb, "dload", "dloadbytes", allow_dst_overlaps_src=True) | |||
self._handle_bb(bb, "dload", "codecopy", allow_dst_overlaps_src=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems sus
@@ -423,15 +423,18 @@ def _optimize_comparator_instruction(self, inst, prefer_iszero): | |||
return | |||
|
|||
after = uses.first() | |||
if not after.opcode == "iszero": | |||
if after.opcode not in ["iszero", "assert"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if after.opcode not in ["iszero", "assert"]: | |
if after.opcode not in ("iszero", "assert"): |
@@ -352,6 +354,34 @@ def _barrier(): | |||
_barrier() | |||
bb.clear_dead_instructions() | |||
|
|||
# This pass is necessary for trivial cases of | |||
# mstore/dload pair merging that contains |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# mstore/dload pair merging that contains | |
# dload/mstore merging that contains |
@@ -24,7 +24,11 @@ def _optimize_branches(self) -> None: | |||
|
|||
cond = term_inst.operands[0] | |||
prev_inst = self.dfg.get_producing_instruction(cond) | |||
if cost_a >= cost_b and prev_inst.opcode == "iszero": | |||
if cost_a >= cost_b and prev_inst.opcode == "eq": | |||
prev_inst.opcode = "xor" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is only valid if prev_inst
has no other uses
instruction that can benefit from inserting iszero
What I did
How I did it
How to verify it
Commit message
Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)
Description for the changelog
Cute Animal Picture