Skip to content

Commit

Permalink
Check for cycles in addEdgeHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
mn416 committed Mar 25, 2016
1 parent 6972c68 commit 071c2d6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,15 @@ bool Analysis::computeNext()
return true;
}

bool Analysis::existsPath(InstrId src, InstrId dstStore)
bool Analysis::existsPath(InstrId src, InstrId dst)
{
Instr dstInstr = trace->instrs[dstStore];
Instr dstInstr = trace->instrs[dst];
int idx = dstInstr.tid * trace->numAddrs + dstInstr.addr;
return nextStore[src][idx] <= dstStore;
if (dstInstr.op == ST || dstInstr.op == RMW)
return nextStore[src][idx] <= dst;
else if (dstInstr.op == LD)
return nextLoad[src][idx] <= dst;
return false;
}

void Analysis::inferFrom(InstrId src, Seq<Edge>* inferred)
Expand Down Expand Up @@ -173,6 +177,8 @@ bool Analysis::addEdgeHelper(Edge e, Seq<Edge>* inferred)
Seq<InstrId> in(64);

if (graph->outEdges[e.src].member(e.dst)) return true;
if (existsPath(e.dst, e.src)) return false;
if (existsPath(e.src, e.dst)) return true;
back.addEdge(graph, e);
propagateInstr(e.dst, e.src);
propagateNext(e.dst, e.src);
Expand Down

0 comments on commit 071c2d6

Please sign in to comment.