X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=cyclegraph.cc;h=e1d5b3c50ef1a243eac7c2955e55d0b4a6b0e67d;hb=8bfca9bf950597e9967e62e02f7a5048e6cf4896;hp=2280e76e3e208b8ac6ce6e2044433c1a866d2c85;hpb=80ab61e4168b993a319788c70fd41e63a34ba627;p=model-checker.git diff --git a/cyclegraph.cc b/cyclegraph.cc index 2280e76..e1d5b3c 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -43,11 +43,14 @@ CycleNode * CycleGraph::getNode(const ModelAction *action) { void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) { ASSERT(from); ASSERT(to); - ASSERT(from != to); CycleNode *fromnode=getNode(from); CycleNode *tonode=getNode(to); + if (!hasCycles) { + // Reflexive edges are cycles + hasCycles = (from == to); + } if (!hasCycles) { // Check for Cycles hasCycles=checkReachable(tonode, fromnode); @@ -85,7 +88,6 @@ void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) { void CycleGraph::addRMWEdge(const ModelAction *from, const ModelAction *rmw) { ASSERT(from); ASSERT(rmw); - ASSERT(from != rmw); CycleNode *fromnode=getNode(from); CycleNode *rmwnode=getNode(rmw); @@ -114,6 +116,10 @@ void CycleGraph::addRMWEdge(const ModelAction *from, const ModelAction *rmw) { } + if (!hasCycles) { + // Reflexive edges are cycles + hasCycles = (from == rmw); + } if (!hasCycles) { // With promises we could be setting up a cycle here if we aren't // careful...avoid it..