Fixes for invalid cleanups for small types.

This commit is contained in:
chriseth
2016-05-20 16:52:40 +02:00
parent a09583a2a4
commit 708129abd5
5 changed files with 19 additions and 26 deletions
+5 -2
View File
@@ -360,8 +360,11 @@ bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation)
m_context << commonType.literalValue(nullptr);
else
{
bool cleanupNeeded = commonType.category() == Type::Category::Integer &&
(Token::isCompareOp(c_op) || c_op == Token::Div || c_op == Token::Mod);
bool cleanupNeeded = false;
if (Token::isCompareOp(c_op))
cleanupNeeded = true;
if (commonType.category() == Type::Category::Integer && (c_op == Token::Div || c_op == Token::Mod))
cleanupNeeded = true;
// for commutative operators, push the literal as late as possible to allow improved optimization
auto isLiteral = [](Expression const& _e)