]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
rose: don't merge large acyclic suffixes
authorJustin Viiret <justin.viiret@intel.com>
Fri, 5 Aug 2016 00:52:24 +0000 (10:52 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Fri, 28 Oct 2016 03:43:33 +0000 (14:43 +1100)
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

index 759e0dbeafaeb7ab1623a27592d4cc68cf6c90fb..dbd580ed36db2f9f4d8841325a29d578eb9edcb4 100644 (file)
@@ -2189,6 +2189,11 @@ void mergeSuffixes(RoseBuildImpl &tbi, SuffixBouquet &suffixes,
         suffix_id s1 = *it;
         const deque<RoseVertex> &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<suffix_id> 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;
         }