36
36
#include < range/v3/algorithm/any_of.hpp>
37
37
38
38
#include < string>
39
- #include < tuple>
40
39
#include < memory>
41
40
42
41
using namespace solidity ::langutil;
@@ -319,7 +318,7 @@ BOOST_AUTO_TEST_CASE(cse_associativity2)
319
318
320
319
BOOST_AUTO_TEST_CASE (cse_double_shift_right_overflow)
321
320
{
322
- if (solidity::test:: CommonOptions::get ().evmVersion ().hasBitwiseShifting ())
321
+ if (CommonOptions::get ().evmVersion ().hasBitwiseShifting ())
323
322
{
324
323
AssemblyItems input{
325
324
Instruction::CALLVALUE,
@@ -334,7 +333,7 @@ BOOST_AUTO_TEST_CASE(cse_double_shift_right_overflow)
334
333
335
334
BOOST_AUTO_TEST_CASE (cse_double_shift_left_overflow)
336
335
{
337
- if (solidity::test:: CommonOptions::get ().evmVersion ().hasBitwiseShifting ())
336
+ if (CommonOptions::get ().evmVersion ().hasBitwiseShifting ())
338
337
{
339
338
AssemblyItems input{
340
339
Instruction::DUP1,
@@ -1001,7 +1000,7 @@ BOOST_AUTO_TEST_CASE(clear_unreachable_code)
1001
1000
AssemblyItem (PushTag, 1 ),
1002
1001
Instruction::JUMP
1003
1002
};
1004
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1003
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1005
1004
BOOST_REQUIRE (peepOpt.optimise ());
1006
1005
BOOST_CHECK_EQUAL_COLLECTIONS (
1007
1006
items.begin (), items.end (),
@@ -1040,7 +1039,7 @@ BOOST_AUTO_TEST_CASE(clear_unreachable_code_eof, *boost::unit_test::precondition
1040
1039
Instruction::SSTORE,
1041
1040
blockTerminatingItem,
1042
1041
};
1043
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1042
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1044
1043
BOOST_REQUIRE (peepOpt.optimise ());
1045
1044
BOOST_CHECK_EQUAL_COLLECTIONS (
1046
1045
items.begin (), items.end (),
@@ -1069,7 +1068,7 @@ BOOST_AUTO_TEST_CASE(is_zero_is_zero_rjumpi, *boost::unit_test::precondition(onE
1069
1068
AssemblyItem (Tag, 1 ),
1070
1069
};
1071
1070
1072
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1071
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1073
1072
BOOST_REQUIRE (peepOpt.optimise ());
1074
1073
BOOST_CHECK_EQUAL_COLLECTIONS (
1075
1074
items.begin (), items.end (),
@@ -1100,7 +1099,7 @@ BOOST_AUTO_TEST_CASE(equal_is_zero_rjumpi, *boost::unit_test::precondition(onEOF
1100
1099
AssemblyItem (Tag, 1 ),
1101
1100
};
1102
1101
1103
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1102
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1104
1103
BOOST_REQUIRE (peepOpt.optimise ());
1105
1104
BOOST_CHECK_EQUAL_COLLECTIONS (
1106
1105
items.begin (), items.end (),
@@ -1130,7 +1129,7 @@ BOOST_AUTO_TEST_CASE(double_rjump, *boost::unit_test::precondition(onEOF()))
1130
1129
AssemblyItem (Tag, 2 ),
1131
1130
};
1132
1131
1133
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1132
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1134
1133
BOOST_REQUIRE (peepOpt.optimise ());
1135
1134
BOOST_CHECK_EQUAL_COLLECTIONS (
1136
1135
items.begin (), items.end (),
@@ -1153,7 +1152,7 @@ BOOST_AUTO_TEST_CASE(rjump_to_next, *boost::unit_test::precondition(onEOF()))
1153
1152
Instruction::SLOAD,
1154
1153
};
1155
1154
1156
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1155
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1157
1156
BOOST_REQUIRE (peepOpt.optimise ());
1158
1157
BOOST_CHECK_EQUAL_COLLECTIONS (
1159
1158
items.begin (), items.end (),
@@ -1177,7 +1176,7 @@ BOOST_AUTO_TEST_CASE(rjumpi_to_next, *boost::unit_test::precondition(onEOF()))
1177
1176
Instruction::SLOAD,
1178
1177
};
1179
1178
1180
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1179
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1181
1180
BOOST_REQUIRE (peepOpt.optimise ());
1182
1181
BOOST_CHECK_EQUAL_COLLECTIONS (
1183
1182
items.begin (), items.end (),
@@ -1205,7 +1204,7 @@ BOOST_AUTO_TEST_CASE(deduplicateNextTagBlockSize3)
1205
1204
u256 (1 ),
1206
1205
Instruction::REVERT
1207
1206
};
1208
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1207
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1209
1208
BOOST_REQUIRE (peepOpt.optimise ());
1210
1209
BOOST_CHECK_EQUAL_COLLECTIONS (
1211
1210
items.begin (), items.end (),
@@ -1230,7 +1229,7 @@ BOOST_AUTO_TEST_CASE(deduplicateNextTagBlockSize2)
1230
1229
u256 (0 ),
1231
1230
Instruction::SELFDESTRUCT
1232
1231
};
1233
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1232
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1234
1233
BOOST_REQUIRE (peepOpt.optimise ());
1235
1234
BOOST_CHECK_EQUAL_COLLECTIONS (
1236
1235
items.begin (), items.end (),
@@ -1252,7 +1251,7 @@ BOOST_AUTO_TEST_CASE(deduplicateNextTagBlockSize1)
1252
1251
AssemblyItem (Tag, 2 ),
1253
1252
Instruction::STOP
1254
1253
};
1255
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1254
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1256
1255
BOOST_REQUIRE (peepOpt.optimise ());
1257
1256
BOOST_CHECK_EQUAL_COLLECTIONS (
1258
1257
items.begin (), items.end (),
@@ -1280,7 +1279,7 @@ BOOST_AUTO_TEST_CASE(peephole_double_push)
1280
1279
};
1281
1280
1282
1281
// `PUSH0 PUSH0` is cheaper than `DUP1 PUSH0`
1283
- if (solidity::test:: CommonOptions::get ().evmVersion () >= EVMVersion::shanghai ())
1282
+ if (CommonOptions::get ().evmVersion () >= EVMVersion::shanghai ())
1284
1283
expectation = {
1285
1284
u256 (0 ),
1286
1285
u256 (0 ),
@@ -1290,7 +1289,7 @@ BOOST_AUTO_TEST_CASE(peephole_double_push)
1290
1289
u256 (5 )
1291
1290
};
1292
1291
1293
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1292
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1294
1293
BOOST_REQUIRE (peepOpt.optimise ());
1295
1294
BOOST_CHECK_EQUAL_COLLECTIONS (
1296
1295
items.begin (), items.end (),
@@ -1306,7 +1305,7 @@ BOOST_AUTO_TEST_CASE(peephole_pop_calldatasize)
1306
1305
Instruction::LT,
1307
1306
Instruction::POP
1308
1307
};
1309
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1308
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1310
1309
for (size_t i = 0 ; i < 3 ; i++)
1311
1310
BOOST_CHECK (peepOpt.optimise ());
1312
1311
BOOST_CHECK (items.empty ());
@@ -1339,7 +1338,7 @@ BOOST_AUTO_TEST_CASE(peephole_commutative_swap1)
1339
1338
u256 (4 ),
1340
1339
u256 (5 )
1341
1340
};
1342
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1341
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1343
1342
BOOST_REQUIRE (peepOpt.optimise ());
1344
1343
BOOST_CHECK_EQUAL_COLLECTIONS (
1345
1344
items.begin (), items.end (),
@@ -1377,7 +1376,7 @@ BOOST_AUTO_TEST_CASE(peephole_noncommutative_swap1)
1377
1376
u256 (4 ),
1378
1377
u256 (5 )
1379
1378
};
1380
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1379
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1381
1380
BOOST_REQUIRE (!peepOpt.optimise ());
1382
1381
BOOST_CHECK_EQUAL_COLLECTIONS (
1383
1382
items.begin (), items.end (),
@@ -1412,7 +1411,7 @@ BOOST_AUTO_TEST_CASE(peephole_swap_comparison)
1412
1411
u256 (4 ),
1413
1412
u256 (5 )
1414
1413
};
1415
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1414
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1416
1415
BOOST_REQUIRE (peepOpt.optimise ());
1417
1416
BOOST_CHECK_EQUAL_COLLECTIONS (
1418
1417
items.begin (), items.end (),
@@ -1438,7 +1437,7 @@ BOOST_AUTO_TEST_CASE(peephole_truthy_and)
1438
1437
AssemblyItem (PushTag, 1 ),
1439
1438
Instruction::JUMPI
1440
1439
};
1441
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1440
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1442
1441
BOOST_REQUIRE (peepOpt.optimise ());
1443
1442
BOOST_CHECK_EQUAL_COLLECTIONS (
1444
1443
items.begin (), items.end (),
@@ -1471,7 +1470,7 @@ BOOST_AUTO_TEST_CASE(peephole_iszero_iszero_jumpi)
1471
1470
u256 (0x20 ),
1472
1471
Instruction::RETURN
1473
1472
};
1474
- PeepholeOptimiser peepOpt (items, solidity::test:: CommonOptions::get ().evmVersion ());
1473
+ PeepholeOptimiser peepOpt (items, CommonOptions::get ().evmVersion ());
1475
1474
BOOST_REQUIRE (peepOpt.optimise ());
1476
1475
BOOST_CHECK_EQUAL_COLLECTIONS (
1477
1476
items.begin (), items.end (),
@@ -1513,7 +1512,7 @@ BOOST_AUTO_TEST_CASE(jumpdest_removal_subassemblies, *boost::unit_test::precondi
1513
1512
// tag unifications (due to block deduplication) is also
1514
1513
// visible at the super-assembly.
1515
1514
1516
- solAssert (!solidity::test:: CommonOptions::get ().eofVersion ().has_value ());
1515
+ solAssert (!CommonOptions::get ().eofVersion ().has_value ());
1517
1516
Assembly::OptimiserSettings settings;
1518
1517
settings.runInliner = false ;
1519
1518
settings.runJumpdestRemover = true ;
@@ -1728,7 +1727,7 @@ BOOST_AUTO_TEST_CASE(verbatim_knownstate)
1728
1727
1729
1728
BOOST_AUTO_TEST_CASE (cse_remove_redundant_shift_masking)
1730
1729
{
1731
- if (!solidity::test:: CommonOptions::get ().evmVersion ().hasBitwiseShifting ())
1730
+ if (!CommonOptions::get ().evmVersion ().hasBitwiseShifting ())
1732
1731
return ;
1733
1732
1734
1733
for (unsigned i = 1 ; i < 256 ; i++)
@@ -1876,7 +1875,7 @@ BOOST_AUTO_TEST_CASE(cse_remove_unwanted_masking_of_address)
1876
1875
1877
1876
BOOST_AUTO_TEST_CASE (cse_replace_too_large_shift)
1878
1877
{
1879
- if (!solidity::test:: CommonOptions::get ().evmVersion ().hasBitwiseShifting ())
1878
+ if (!CommonOptions::get ().evmVersion ().hasBitwiseShifting ())
1880
1879
return ;
1881
1880
1882
1881
checkCSE ({
0 commit comments