diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Expr/ArrayExprVisitor.cpp | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/lib/Expr/ArrayExprVisitor.cpp b/lib/Expr/ArrayExprVisitor.cpp index c12689b3..0965308a 100644 --- a/lib/Expr/ArrayExprVisitor.cpp +++ b/lib/Expr/ArrayExprVisitor.cpp @@ -58,41 +58,9 @@ ReadExpr *ArrayExprHelper::hasOrderedReads(const ConcatExpr &ce) { ExprVisitor::Action ConstantArrayExprVisitor::visitConcat(const ConcatExpr &ce) { ReadExpr *base = ArrayExprHelper::hasOrderedReads(ce); - if (base) { - // It is an interesting ReadExpr if it contains a concrete array - // that is read at a symbolic index - if (base->updates.root->isConstantArray() && - !isa<ConstantExpr>(base->index)) { - for (const auto *un = base->updates.head.get(); un; un = un->next.get()) { - if (!isa<ConstantExpr>(un->index) || !isa<ConstantExpr>(un->value)) { - incompatible = true; - return Action::skipChildren(); - } - } - IndexCompatibilityExprVisitor compatible; - compatible.visit(base->index); - if (compatible.isCompatible() && - addedIndexes.find(base->index.get()->hash()) == addedIndexes.end()) { - if (arrays.find(base->updates.root) == arrays.end()) { - arrays.insert( - std::make_pair(base->updates.root, std::vector<ref<Expr> >())); - } else { - // Another possible index to resolve, currently unsupported - incompatible = true; - return Action::skipChildren(); - } - arrays.find(base->updates.root)->second.push_back(base->index); - addedIndexes.insert(base->index.get()->hash()); - } else if (compatible.hasInnerReads()) { - // This Read has an inner Read, we want to optimize the inner one - // to create a cascading effect during assignment evaluation - return Action::doChildren(); - } - return Action::skipChildren(); - } - } - return Action::doChildren(); + return base ? visitRead(*base) : Action::doChildren(); } + ExprVisitor::Action ConstantArrayExprVisitor::visitRead(const ReadExpr &re) { // It is an interesting ReadExpr if it contains a concrete array // that is read at a symbolic index |