aboutsummaryrefslogtreecommitdiffstats
path: root/CommonSubexpressionEliminator.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-05-13 03:27:04 +0800
committerchriseth <c@ethdev.com>2015-05-13 23:15:32 +0800
commitcebc959ff3d7dab6a41833013ffe22728def3221 (patch)
treec997849fb951a132c06ffaf3af45b3f3958f3f12 /CommonSubexpressionEliminator.cpp
parent2654daab2628181597bb4c35ae69ca378248f8ba (diff)
downloaddexon-solidity-cebc959ff3d7dab6a41833013ffe22728def3221.tar
dexon-solidity-cebc959ff3d7dab6a41833013ffe22728def3221.tar.gz
dexon-solidity-cebc959ff3d7dab6a41833013ffe22728def3221.tar.bz2
dexon-solidity-cebc959ff3d7dab6a41833013ffe22728def3221.tar.lz
dexon-solidity-cebc959ff3d7dab6a41833013ffe22728def3221.tar.xz
dexon-solidity-cebc959ff3d7dab6a41833013ffe22728def3221.tar.zst
dexon-solidity-cebc959ff3d7dab6a41833013ffe22728def3221.zip
Known state: store tags on stack as unions.
Diffstat (limited to 'CommonSubexpressionEliminator.cpp')
-rw-r--r--CommonSubexpressionEliminator.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/CommonSubexpressionEliminator.cpp b/CommonSubexpressionEliminator.cpp
index e369c9db..7564fcd9 100644
--- a/CommonSubexpressionEliminator.cpp
+++ b/CommonSubexpressionEliminator.cpp
@@ -153,7 +153,9 @@ AssemblyItems CSECodeGenerator::generateCode(
assertThrow(!m_classPositions[targetItem.second].empty(), OptimizerException, "");
if (m_classPositions[targetItem.second].count(targetItem.first))
continue;
- SourceLocation const& location = m_expressionClasses.representative(targetItem.second).item->getLocation();
+ SourceLocation location;
+ if (m_expressionClasses.representative(targetItem.second).item)
+ location = m_expressionClasses.representative(targetItem.second).item->getLocation();
int position = classElementPosition(targetItem.second);
if (position < targetItem.first)
// it is already at its target, we need another copy
@@ -197,7 +199,9 @@ void CSECodeGenerator::addDependencies(Id _c)
addDependencies(argument);
m_neededBy.insert(make_pair(argument, _c));
}
- if (expr.item->type() == Operation && (
+ if (
+ expr.item &&
+ expr.item->type() == Operation && (
expr.item->instruction() == Instruction::SLOAD ||
expr.item->instruction() == Instruction::MLOAD ||
expr.item->instruction() == Instruction::SHA3
@@ -288,6 +292,7 @@ void CSECodeGenerator::generateClassElement(Id _c, bool _allowSequenced)
OptimizerException,
"Sequence constrained operation requested out of sequence."
);
+ assertThrow(expr.item, OptimizerException, "Non-generated expression without item.");
vector<Id> const& arguments = expr.arguments;
for (Id arg: boost::adaptors::reverse(arguments))
generateClassElement(arg);