From 8be6c8b2cac99dd06c0eeb1b82a19f3d11c688ae Mon Sep 17 00:00:00 2001 From: Justin Viiret Date: Fri, 5 Aug 2016 10:52:24 +1000 Subject: [PATCH] rose: don't merge large acyclic suffixes Check earlier on in mergeSuffixes that we're not proposing to merge suffixes above our limit from the acyclic merge path. --- src/rose/rose_build_merge.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/rose/rose_build_merge.cpp b/src/rose/rose_build_merge.cpp index 759e0dbe..dbd580ed 100644 --- a/src/rose/rose_build_merge.cpp +++ b/src/rose/rose_build_merge.cpp @@ -2189,6 +2189,11 @@ void mergeSuffixes(RoseBuildImpl &tbi, SuffixBouquet &suffixes, suffix_id s1 = *it; const deque &verts1 = suffixes.vertices(s1); assert(s1.graph() && s1.graph()->kind == NFA_SUFFIX); + + // Caller should ensure that we don't propose merges of graphs that are + // already too big. + assert(num_vertices(*s1.graph()) < small_merge_max_vertices(tbi.cc)); + deque merged; for (auto jt = next(it); jt != suffixes.end(); ++jt) { suffix_id s2 = *jt; @@ -2306,6 +2311,10 @@ void mergeAcyclicSuffixes(RoseBuildImpl &tbi) { assert(!g[v].suffix.haig); + if (num_vertices(*h) >= small_merge_max_vertices(tbi.cc)) { + continue; + } + if (!isAcyclic(*h)) { continue; }