about summary refs log tree commit diff homepage
path: root/lib/Expr/ExprUtil.cpp
diff options
context:
space:
mode:
authorTimotej Kapus <timotej.kapus13@imperial.ac.uk>2018-03-16 10:42:12 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2018-05-09 12:19:53 +0100
commit13b5bcbfd933461526f08c6ad759af9e129d6764 (patch)
treefb3eb848493ccf697f8193aeae81d098874dc340 /lib/Expr/ExprUtil.cpp
parente0aff85c24c039606d82d209617a1334a9ed21e2 (diff)
downloadklee-13b5bcbfd933461526f08c6ad759af9e129d6764.tar.gz
Improve handling of constant array in Z3
Diffstat (limited to 'lib/Expr/ExprUtil.cpp')
-rw-r--r--lib/Expr/ExprUtil.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Expr/ExprUtil.cpp b/lib/Expr/ExprUtil.cpp
index ed60a4a9..2106b226 100644
--- a/lib/Expr/ExprUtil.cpp
+++ b/lib/Expr/ExprUtil.cpp
@@ -104,6 +104,21 @@ public:
     : objects(_objects) {}
 };
 
+ExprVisitor::Action ConstantArrayFinder::visitRead(const ReadExpr &re) {
+  const UpdateList &ul = re.updates;
+
+  // FIXME should we memo better than what ExprVisitor is doing for us?
+  for (const UpdateNode *un = ul.head; un; un = un->next) {
+    visit(un->index);
+    visit(un->value);
+  }
+
+  if (ul.root->isConstantArray()) {
+    results.insert(ul.root);
+  }
+
+  return Action::doChildren();
+}
 }
 
 template<typename InputIterator>