model: stop thread-trace search once edge is added
authorBrian Norris <banorris@uci.edu>
Wed, 5 Dec 2012 20:20:31 +0000 (12:20 -0800)
committerBrian Norris <banorris@uci.edu>
Wed, 5 Dec 2012 20:29:04 +0000 (12:29 -0800)
Once an edge has been added from 'act' to the current thread (or the
'rf' thread), we don't need to continue to search for more edges.

model.cc

index b73d31a579051c94cb909cac5d7e8330cde00ee0..715a2584f36a1538528489d60f987142ad0f2a77 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -1517,18 +1517,21 @@ bool ModelChecker::r_modification_order(ModelAction *curr, const ModelAction *rf
                                                *act < *last_sc_fence_thread_local) {
                                        mo_graph->addEdge(act, rf);
                                        added = true;
+                                       break;
                                }
                                /* C++, Section 29.3 statement 4 */
                                else if (act->is_seqcst() && last_sc_fence_local &&
                                                *act < *last_sc_fence_local) {
                                        mo_graph->addEdge(act, rf);
                                        added = true;
+                                       break;
                                }
                                /* C++, Section 29.3 statement 6 */
                                else if (last_sc_fence_thread_before &&
                                                *act < *last_sc_fence_thread_before) {
                                        mo_graph->addEdge(act, rf);
                                        added = true;
+                                       break;
                                }
                        }
 
@@ -1705,6 +1708,7 @@ bool ModelChecker::w_modification_order(ModelAction *curr)
                                        *act < *last_sc_fence_thread_before) {
                                mo_graph->addEdge(act, curr);
                                added = true;
+                               break;
                        }
 
                        /*