diff --git a/include/mpi_collective.hpp b/include/mpi_collective.hpp index f019236ae94557d814e9035df203dbe995b58a0e..fcd02820725c5ac81d94ec92e04163d1c9396d7f 100644 --- a/include/mpi_collective.hpp +++ b/include/mpi_collective.hpp @@ -89,10 +89,7 @@ public: void reset_bb_mark(function *fun); void alloc_edge_aux(function *fun); void free_edge_aux(function *fun); - // loop detection algorithms - void __mark_edge_naif(function *fun); - void __mark_edge_naif(basic_block bb); - void __mark_edge_test(function *fun); + // loop detection algorithm void mark_edge(function *fun); void mark_edge(basic_block bb); diff --git a/src/mpi_collective_graph_utils.cpp b/src/mpi_collective_graph_utils.cpp index b59f4d64956ebd72c7451b1a8e5d4ea638bd826b..6bce6909dabc029655ffa8627d658cabfb06bcfe 100644 --- a/src/mpi_collective_graph_utils.cpp +++ b/src/mpi_collective_graph_utils.cpp @@ -92,105 +92,6 @@ void pass_mpi_collective::free_edge_aux(function *fun) } // loop detection -// naive version of mark_edge (work but Omax(2^n)) -void pass_mpi_collective::__mark_edge_naif(function *fun) -{ - __mark_edge_naif(ENTRY_BLOCK_PTR_FOR_FN(fun)); -} - -void pass_mpi_collective::__mark_edge_naif(basic_block bb) -{ - edge e; - edge_iterator ei; - - ((bb_data *) bb->aux)->mark1 = 1; - FOR_EACH_EDGE(e, ei, bb->succs) - { - if (((bb_data *) e->dest->aux)->mark1) - { - ((edge_data *) e->aux)->loop = true; - } - else - { - __mark_edge_naif(e->dest); - } - } - ((bb_data *) bb->aux)->mark1 = 0; -} - -void pass_mpi_collective::__mark_edge_test(function *fun) -{ - - edge e1; - edge_iterator ei1; - std::list<basic_block> nodes1; - basic_block bb; - - edge e2; - edge_iterator ei2; - std::list<basic_block> nodes2; - basic_block cursor; - - int index; - - index = 0; - - nodes1.push_back(ENTRY_BLOCK_PTR_FOR_FN(fun)); - ((bb_data *) ENTRY_BLOCK_PTR_FOR_FN(fun)->aux)->mark1 = 1; - - while (!nodes1.empty()) - { - bb = nodes1.front(); - nodes1.pop_front(); - - FOR_EACH_EDGE(e1, ei1, bb->succs) - { - if (((bb_data *) e1->dest->aux)->mark1) - { - continue; - } - ((bb_data *) bb->aux)->mark1 = 1; - nodes1.push_back(e1->dest); - } - - if (EDGE_COUNT(bb->preds) < 2) - { - continue; - } - - ++index; - nodes2.clear(); - nodes2.push_back(bb); - ((bb_data *) bb->aux)->mark2 = index; - - while (!nodes2.empty()) - { - cursor = nodes2.front(); - nodes2.pop_front(); - - FOR_EACH_EDGE(e2, ei2, cursor->succs) - { - if (e2->dest == bb) - { - ((edge_data *) e2->aux)->loop = true; - } - if (((edge_data *) e2->aux)->loop) - { - continue; - } - - if (((bb_data *) e2->dest->aux)->mark2 >= index) - { - continue; - } - ((bb_data *) cursor->aux)->mark2 = index; - nodes2.push_back(e2->dest); - } - } - } - reset_bb_mark(fun); -} - void pass_mpi_collective::mark_edge(function *fun) { mark_edge(ENTRY_BLOCK_PTR_FOR_FN(fun));