solidity
solidity copied to clipboard
Optimize AND/SHL
trafficstars
and(shl(A, X), shl(A, Y))
should be optimized to
shl(A, and(X, Y))
or even
and(shl(Z, X), shl(Z, Y))
should be optimized to
shl(Z, and(X, Y))
@chriseth I can't find any difference between the 2 provided examples? Is it a typo?
The difference stems from how we internally formulate simplification rules in https://github.com/ethereum/solidity/blob/develop/libevmasm/RuleList.h and isn't clear in the issue description - we use A, B, C, ... for constants and X, Y, Z, ... for arbitrary expressions when pattern matching simplification rules.
@ekpyron thx!