-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Remove superfluous initial iteration of repeating parts of optimizer sequence #14854
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,18 +20,46 @@ | |
| // { | ||
| // { | ||
| // f() | ||
| // f() | ||
| // f() | ||
| // f_72() | ||
| // f_73() | ||
| // sstore(0, 1) | ||
| // } | ||
| // function f() | ||
| // { | ||
| // let a := 1 | ||
| // let b := 10 | ||
| // let a_1 := calldataload(0) | ||
| // let _1 := iszero(a_1) | ||
| // for { } iszero(b) { b := add(b, not(0)) } | ||
| // { | ||
| // a := a_1 | ||
| // mstore(a_1, 0) | ||
| // if _1 { leave } | ||
| // } | ||
| // } | ||
| // function f_72() | ||
| // { | ||
| // let a := 2 | ||
| // let b := 10 | ||
| // let a_1 := calldataload(0) | ||
| // let _1 := iszero(a_1) | ||
| // for { } iszero(b) { b := add(b, not(0)) } | ||
| // { | ||
| // a := a_1 | ||
| // mstore(a_1, 0) | ||
| // if _1 { leave } | ||
| // } | ||
| // } | ||
| // function f_73() | ||
| // { | ||
| // let a := 3 | ||
| // let b := 10 | ||
| // let a := calldataload(0) | ||
| // let _1 := iszero(a) | ||
| // let a_1 := calldataload(0) | ||
| // let _1 := iszero(a_1) | ||
| // for { } iszero(b) { b := add(b, not(0)) } | ||
| // { | ||
| // mstore(a, 0) | ||
| // a := a_1 | ||
| // mstore(a_1, 0) | ||
| // if _1 { leave } | ||
| // } | ||
| // } | ||
|
Comment on lines
23
to
65
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the changes show up not only as gas differences. Two tests also got updated output. In this case it looks like a clear downgrade. The optimizer is definitely leaving some possible optimizations on the table. Still, not sure how common this is in practice. I'm going to play with this when tweaking the optimizer sequence.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, the optimizer is mainly being rather stupid here - it specializes all three calls and then trusts that since the arguments are unused, the result will collapse to identical functions that can be deduplicated... the simpler choice would have been to not specialize in the first place. |
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.