Implement references using InvertibleRelation as data structure.

This commit is contained in:
chriseth
2019-05-27 22:55:59 +02:00
parent b836079006
commit 4061ad0a7b
7 changed files with 86 additions and 23 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ void Rematerialiser::visit(Expression& _e)
if (refs <= 1 || cost == 0 || (refs <= 5 && cost <= 1) || m_varsToAlwaysRematerialize.count(name))
{
assertThrow(m_referenceCounts[name] > 0, OptimizerException, "");
for (auto const& ref: m_references[name])
for (auto const& ref: m_references.forward[name])
assertThrow(inScope(ref), OptimizerException, "");
// update reference counts
m_referenceCounts[name]--;