Move AND with constant inside OR.

This commit is contained in:
chriseth
2021-03-09 15:26:19 +01:00
parent 1d95f95635
commit 40c27ccc22
7 changed files with 152 additions and 0 deletions
@@ -0,0 +1 @@
--optimize --asm --metadata-hash none
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
contract OptimizeFullSlotWrite {
uint64[4] nums;
function f() public {
nums[0] = 11111;
nums[1] = 22222;
nums[2] = 33333;
nums[3] = 44444;
}
}
@@ -0,0 +1,64 @@
======= optimize_full_storage_write/input.sol:OptimizeFullSlotWrite =======
EVM assembly:
/* "optimize_full_storage_write/input.sol":60:213 contract OptimizeFullSlotWrite {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* "optimize_full_storage_write/input.sol":60:213 contract OptimizeFullSlotWrite {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* "optimize_full_storage_write/input.sol":111:211 function f() public {... */
tag_3:
tag_4
/* "optimize_full_storage_write/input.sol":192:207 nums[3] = 44444 */
0xad9c000000000000823500000000000056ce0000000000002b67
/* "optimize_full_storage_write/input.sol":135:139 nums */
0x00
/* "optimize_full_storage_write/input.sol":192:207 nums[3] = 44444 */
sstore
/* "optimize_full_storage_write/input.sol":111:211 function f() public {... */
jump
tag_4:
stop
auxdata: <AUXDATA REMOVED>
}