Remove a redundant SnapVector
authorweiyu <weiyuluo1232@gmail.com>
Fri, 18 Oct 2019 18:10:34 +0000 (11:10 -0700)
committerweiyu <weiyuluo1232@gmail.com>
Fri, 18 Oct 2019 18:10:34 +0000 (11:10 -0700)
newfuzzer.cc

index 6a9f930506d95d16789e10ff2516aa0b1adc4afd..9d061bbf9a857d41938bb7394d00d18e4bffed1b 100644 (file)
@@ -127,44 +127,36 @@ void NewFuzzer::check_store_visibility(Predicate * curr_pred, FuncInst * read_in
                return;
 
        ModelVector<Predicate *> * children = curr_pred->get_children();
-       SnapVector<Predicate *> branches;
 
-       /* The children predicates may have different FuncInsts */
+       /* Iterate over all predicate children */
        for (uint i = 0; i < children->size(); i++) {
-               Predicate * child = (*children)[i];
-               if (child->get_func_inst() == read_inst) {
-                       branches.push_back(child);
-               }
-       }
+               Predicate * branch = (*children)[i];
 
-       /* Predicate children have not been generated */
-       if (branches.empty())
-               return;
+               /* The children predicates may have different FuncInsts */
+               if (branch->get_func_inst() == read_inst) {
+                       PredExprSet * pred_expressions = branch->get_pred_expressions();
 
-       /* Iterate over all predicate children */
-       for (uint i = 0; i < branches.size(); i++) {
-               Predicate * branch = branches[i];
-               PredExprSet * pred_expressions = branch->get_pred_expressions();
-
-               /* Do not check unset predicates */
-               if (pred_expressions->isEmpty())
-                       continue;
-
-               branch->incr_total_checking_count();
-
-               /* Iterate over all write actions */
-               for (uint j = 0; j < rf_set->size(); j++) {
-                       ModelAction * write_act = (*rf_set)[j];
-                       uint64_t write_val = write_act->get_write_value();
-                       bool dummy = true;
-                       bool satisfy_predicate = check_predicate_expressions(pred_expressions, inst_act_map, write_val, &dummy);
-
-                       /* If one write value satisfies the predicate, go to check the next predicate */
-                       if (satisfy_predicate) {
-                               branch->incr_store_visible_count();
-                               break;
+                       /* Do not check unset predicates */
+                       if (pred_expressions->isEmpty())
+                               continue;
+
+                       branch->incr_total_checking_count();
+
+                       /* Iterate over all write actions */
+                       for (uint j = 0; j < rf_set->size(); j++) {
+                               ModelAction * write_act = (*rf_set)[j];
+                               uint64_t write_val = write_act->get_write_value();
+                               bool dummy = true;
+                               bool satisfy_predicate = check_predicate_expressions(pred_expressions, inst_act_map, write_val, &dummy);
+
+                               /* If one write value satisfies the predicate, go to check the next predicate */
+                               if (satisfy_predicate) {
+                                       branch->incr_store_visible_count();
+                                       break;
+                               }
                        }
                }
+
        }
 }