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

feat[venom]: updates for algebraic opts and memmerge #4469

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

HodanPlodky
Copy link
Collaborator

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

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

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.14%. Comparing base (c75a2da) to head (0e88a1b).

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.
📢 Have feedback on the report? Share it here.

@@ -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)
Copy link
Member

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"]:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# 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"
Copy link
Member

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

@HodanPlodky HodanPlodky marked this pull request as ready for review February 21, 2025 11:37
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.

2 participants