]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
ng_violet: skip analysis on graphs with wide reach
authorJustin Viiret <justin.viiret@intel.com>
Tue, 30 May 2017 07:09:03 +0000 (17:09 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Mon, 21 Aug 2017 01:10:11 +0000 (11:10 +1000)
src/nfagraph/ng_violet.cpp

index 4195045c4c9a944ddca29b5edeb04f53418a47f7..c9460b93c66286a5da1a38faa6f72d4cf5e5cc8a 100644 (file)
@@ -2952,6 +2952,15 @@ RoseInGraph doInitialVioletTransform(const NGHolder &h, bool last_chance,
         return vg;
     }
 
+    /* Avoid running the Violet analysis at all on graphs with no vertices with
+     * small reach, since we will not be able to extract any literals. */
+    if (all_of_in(vertices_range(h), [&](NFAVertex v) {
+            return is_special(v, h) || h[v].char_reach.count() >= 200;
+        })) {
+        DEBUG_PRINTF("fail, no vertices with small reach\n");
+        return vg;
+    }
+
     DEBUG_PRINTF("hello world\n");
 
     /* Step 1: avoid outfixes as we always have to run them. */