Fixes bug in byte optimization rule and adds tests.

This commit is contained in:
Bhargava Shastry
2019-03-21 14:29:06 +01:00
parent 867e5bc64d
commit f7b5a27581
6 changed files with 60 additions and 2 deletions
+20
View File
@@ -268,6 +268,26 @@ BOOST_AUTO_TEST_CASE(cse_double_shift_left_overflow)
}
}
BOOST_AUTO_TEST_CASE(cse_byte_ordering_bug)
{
AssemblyItems input{
u256(31),
Instruction::CALLVALUE,
Instruction::BYTE
};
checkCSE(input, {u256(31), Instruction::CALLVALUE, Instruction::BYTE});
}
BOOST_AUTO_TEST_CASE(cse_byte_ordering_fix)
{
AssemblyItems input{
Instruction::CALLVALUE,
u256(31),
Instruction::BYTE
};
checkCSE(input, {u256(0xff), Instruction::CALLVALUE, Instruction::AND});
}
BOOST_AUTO_TEST_CASE(cse_storage)
{
AssemblyItems input{