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
Pattern PUSH0 SHR appears in optimized code #15024
Comments
@ekpyron This is what I mentioned in our chat, it should be reproducible from this |
note: there could be considerations that this optimization could make an execution diff if the stack had no items on it prior to the |
This seems to be an issue only in the legacy pipeline. With IR pipelineIRsolc test.sol --debug-info none --optimize --optimize-runs 200000 --ir | grep shr shr(224, value)
shr(0, value) Optimized IRsolc test.sol --debug-info none --optimize --optimize-runs 200000 --ir-optimized | grep shr if eq(0x5ec01e4d, shr(224, calldataload(0))) Assemblysolc test.sol --debug-info none --optimize --optimize-runs 200000 --asm --via-ir | grep shr --context=1
legacyAssemblysolc test.sol --debug-info none --optimize --optimize-runs 200000 --asm | grep shr --context=1
|
Legacy and via-IR share the same set of rules here, though... I'd have guessed that we generate a |
Description
Optimizer does not optimize out
PUSH0 SHR
instructions ( x >> 0 is always x)Environment
solc/solc0.8.23 -o build/examples/push0shr.sol/ --overwrite --ast-compact-json --asm --bin-runtime --bin --optimize --optimize-runs 200000 --abi --combined-json=srcmap-runtime,generated-sources-runtime examples/push0shr.so
Steps to Reproduce
compile the following example with the above command:
The pattern appears to be generated by the source location s:l:f = (207, 97, 0)
The text was updated successfully, but these errors were encountered: