]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
role aliasing: bail if new graph is not implementable
authorJustin Viiret <justin.viiret@intel.com>
Wed, 1 Feb 2017 02:08:20 +0000 (13:08 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 26 Apr 2017 04:46:46 +0000 (14:46 +1000)
src/rose/rose_build_role_aliasing.cpp

index 6014215624e0737c8f46abfcba1c35816c205845..3ad4566ebf859648d1568fa09582244cbd39e136 100644 (file)
@@ -1125,6 +1125,8 @@ bool attemptRoseGraphMerge(RoseBuildImpl &build, bool preds_same, RoseVertex a,
     shared_ptr<NGHolder> a_h = a_left.graph;
     shared_ptr<NGHolder> b_h = b_left.graph;
     assert(a_h && b_h);
+    assert(isImplementableNFA(*a_h, nullptr, build.cc));
+    assert(isImplementableNFA(*b_h, nullptr, build.cc));
 
     // If we only differ in reports, this is a very easy merge. Just use b's
     // report for both.
@@ -1215,6 +1217,11 @@ bool attemptRoseGraphMerge(RoseBuildImpl &build, bool preds_same, RoseVertex a,
         duplicateReport(*new_graph, b_left.leftfix_report, new_report);
         pruneAllOtherReports(*new_graph, new_report);
 
+        if (!isImplementableNFA(*new_graph, nullptr, build.cc)) {
+            DEBUG_PRINTF("new graph not implementable\n");
+            return false;
+        }
+
         rai.rev_leftfix[a_left_id].erase(a);
         rai.rev_leftfix[b_left_id].erase(b);
         pruneUnusedTops(*a_h, g, rai.rev_leftfix[a_left_id]);