Yul Optimizer: Remove dead code

This commit is contained in:
Mathias Baumann
2019-04-01 17:16:04 +02:00
parent e7340f2126
commit e20acf5d0a
21 changed files with 482 additions and 3 deletions
+16
View File
@@ -132,6 +132,22 @@ bool SemanticInformation::altersControlFlow(AssemblyItem const& _item)
}
}
bool SemanticInformation::terminatesControlFlow(AssemblyItem const& _item)
{
if (_item.type() != Operation)
return false;
switch (_item.instruction())
{
case Instruction::RETURN:
case Instruction::SELFDESTRUCT:
case Instruction::STOP:
case Instruction::INVALID:
case Instruction::REVERT:
return true;
default:
return false;
}
}
bool SemanticInformation::isDeterministic(AssemblyItem const& _item)
{
+1
View File
@@ -47,6 +47,7 @@ struct SemanticInformation
static bool isSwapInstruction(AssemblyItem const& _item);
static bool isJumpInstruction(AssemblyItem const& _item);
static bool altersControlFlow(AssemblyItem const& _item);
static bool terminatesControlFlow(AssemblyItem const& _item);
/// @returns false if the value put on the stack by _item depends on anything else than
/// the information in the current block header, memory, storage or stack.
static bool isDeterministic(AssemblyItem const& _item);