-
-
Notifications
You must be signed in to change notification settings - Fork 802
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]: add codesize optimization pass #4333
base: master
Are you sure you want to change the base?
feat[venom]: add codesize optimization pass #4333
Conversation
i = 0 | ||
while i < len(bb.instructions): | ||
inst = bb.instructions[i] | ||
i += 1 |
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.
i = 0 | |
while i < len(bb.instructions): | |
inst = bb.instructions[i] | |
i += 1 | |
for inst in bb.instructions: |
|
||
val = op.value | ||
|
||
if val == (2**256 - 1): |
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.
Make use of constants that we have for numbers like these
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.
I have made some comments in the code above. Additionally, we could add some tests for the optimization cases.
@cyberthirst could you take a look at the tests and see if you want to add any cases? |
What I did
basic codesize optimization which strengthens large literals to evm computations which are shorter
How I did it
How to verify it
saves 450 bytes (2.5%) on https://gist.github.com/charles-cooper/eed70340aee2a47478ca0fc2ea6d5140
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