matter-labs / era-compiler-llvm

ZKsync fork of the LLVM framework.
Other
33 stars 16 forks source link

[EraVM] Fix EraVMCombineAddressingMode::mergeSelect for SEL with stac… #696

Closed vladimirradosavljevic closed 2 months ago

vladimirradosavljevic commented 2 months ago

…k as output

This patch fixes the issue in mergeSelect where Base is SEL with stack as output and that output operand is not copied to the newly created SEL. This happens when we are replacing second operand of SEL (IsIn0 is false) with In, and we are not copying rest of the operands, just conditional code.

github-actions[bot] commented 2 months ago

Benchmark results eravm:

╔═╡ Size (-%) ╞════════════════╡ All M3B3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════════════╡ All M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════════════╡ All M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════════════╡ All MzB3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════════════╡ All MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════════════╡ All MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞═════╡ EVMInterpreter M3B3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                                 NaN ║
╠═╡ Cycles (-%) ╞═══╡ EVMInterpreter M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞═════╡ EVMInterpreter M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs/gas ╞══════╡ EVMInterpreter M3B3 ╞═╣
║ ADD                                44.750 ║
║ MUL                                26.850 ║
║ SUB                                44.750 ║
║ DIV                                29.250 ║
║ SDIV                               44.850 ║
║ MOD                                29.250 ║
║ SMOD                               42.450 ║
║ ADDMOD                             23.656 ║
║ MULMOD                             25.906 ║
║ EXP                                 7.338 ║
║ SIGNEXTEND                         26.850 ║
║ LT                                 48.750 ║
║ GT                                 48.750 ║
║ SLT                                72.750 ║
║ SGT                                70.750 ║
║ EQ                                 48.750 ║
║ ISZERO                             40.417 ║
║ AND                                44.750 ║
║ OR                                 44.750 ║
║ XOR                                44.750 ║
║ NOT                                36.417 ║
║ BYTE                               52.750 ║
║ SHL                                50.750 ║
║ SHR                                52.750 ║
║ SAR                                66.750 ║
║ SGT                                70.750 ║
║ SHA3                               27.051 ║
║ ADDRESS                            53.812 ║
║ BALANCE                            72.062 ║
║ ORIGIN                           1349.500 ║
║ CALLER                             53.812 ║
║ CALLVALUE                          53.812 ║
║ CALLDATALOAD                       38.750 ║
║ CALLDATASIZE                       54.125 ║
║ CALLDATACOPY                       69.185 ║
║ CODESIZE                           54.625 ║
║ CODECOPY                           62.456 ║
║ GASPRICE                         1352.312 ║
║ EXTCODESIZE                         4.996 ║
║ EXTCODECOPY                         5.060 ║
║ RETURNDATASIZE                     52.500 ║
║ RETURNDATACOPY                     45.222 ║
║ EXTCODEHASH                         6.153 ║
║ BLOCKHASH                         241.019 ║
║ COINBASE                         1352.500 ║
║ TIMESTAMP                        1349.500 ║
║ NUMBER                           1349.500 ║
║ PREVRANDAO                       1349.500 ║
║ GASLIMIT                         1355.500 ║
║ CHAINID                          1349.500 ║
║ SELFBALANCE                       642.125 ║
║ BASEFEE                          1349.500 ║
║ POP                                44.625 ║
║ MLOAD                              55.248 ║
║ MSTORE                             60.733 ║
║ MSTORE8                            68.480 ║
║ SLOAD                              26.001 ║
║ SSTORE                              8.920 ║
║ JUMP                               17.667 ║
║ JUMPI                              17.273 ║
║ PC                                 54.312 ║
║ MSIZE                              60.812 ║
║ GAS                                51.312 ║
║ JUMPDEST                           77.625 ║
║ PUSH0                              51.312 ║
║ PUSH1                              45.958 ║
║ PUSH2                              49.375 ║
║ PUSH4                              52.208 ║
║ PUSH5                              53.625 ║
║ PUSH6                              55.042 ║
║ PUSH7                              56.458 ║
║ PUSH8                              57.875 ║
║ PUSH9                              59.292 ║
║ PUSH10                             60.708 ║
║ PUSH11                             62.125 ║
║ PUSH12                             63.542 ║
║ PUSH13                             64.958 ║
║ PUSH14                             66.375 ║
║ PUSH15                             67.792 ║
║ PUSH16                             69.208 ║
║ PUSH17                             70.625 ║
║ PUSH18                             72.042 ║
║ PUSH19                             73.458 ║
║ PUSH20                             74.875 ║
║ PUSH21                             76.292 ║
║ PUSH22                             77.708 ║
║ PUSH23                             79.125 ║
║ PUSH24                             80.542 ║
║ PUSH25                             81.958 ║
║ PUSH26                             83.375 ║
║ PUSH27                             84.792 ║
║ PUSH28                             86.208 ║
║ PUSH29                             87.625 ║
║ PUSH30                             89.042 ║
║ PUSH31                             90.458 ║
║ PUSH32                             89.875 ║
║ DUP1                               36.417 ║
║ DUP2                               44.417 ║
║ DUP3                               44.417 ║
║ DUP4                               44.417 ║
║ DUP5                               44.417 ║
║ DUP6                               44.417 ║
║ DUP7                               44.417 ║
║ DUP8                               44.417 ║
║ DUP9                               44.417 ║
║ DUP10                              44.417 ║
║ DUP11                              44.417 ║
║ DUP12                              44.417 ║
║ DUP13                              44.417 ║
║ DUP14                              44.417 ║
║ DUP15                              44.417 ║
║ DUP16                              44.417 ║
║ SWAP1                              43.083 ║
║ SWAP2                              45.083 ║
║ SWAP3                              45.083 ║
║ SWAP4                              45.083 ║
║ SWAP5                              45.083 ║
║ SWAP6                              45.083 ║
║ SWAP7                              45.083 ║
║ SWAP8                              45.083 ║
║ SWAP9                              45.083 ║
║ SWAP10                             45.083 ║
║ SWAP11                             45.083 ║
║ SWAP12                             45.083 ║
║ SWAP13                             45.083 ║
║ SWAP14                             45.083 ║
║ SWAP15                             45.083 ║
║ SWAP16                             45.083 ║
║ CALL                               55.193 ║
║ STATICCALL                         54.227 ║
║ DELEGATECALL                       54.215 ║
║ CREATE                              4.804 ║
║ CREATE2                             6.899 ║
║ RETURN                              1.000 ║
║ REVERT                              1.000 ║
╠═╡ Ergs/gas (-%) ╞═╡ EVMInterpreter M3B3 ╞═╣
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞═════╡ EVMInterpreter MzB3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                                 NaN ║
╠═╡ Cycles (-%) ╞═══╡ EVMInterpreter MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞═════╡ EVMInterpreter MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════╡ Precompiles M3B3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════╡ Precompiles M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════╡ Precompiles M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════╡ Precompiles MzB3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════╡ Precompiles MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════╡ Precompiles MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞══════════╡ Real life M3B3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞════════╡ Real life M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞══════════╡ Real life M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞══════════╡ Real life MzB3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞════════╡ Real life MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞══════════╡ Real life MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝