diff --git a/include/pass_mpi_collective.hpp b/include/pass_mpi_collective.hpp
index e3818119a735561a052a86a28b9a9e37ed48c8e9..44d96f7bcc1aa996854072ce785c7ecbd89df2d6 100644
--- a/include/pass_mpi_collective.hpp
+++ b/include/pass_mpi_collective.hpp
@@ -77,7 +77,7 @@ public:
 	void alloc_edge_aux(function *fun);
 	void free_edge_aux(function *fun);
 	void mark_edge(function *fun);
-	void mark_edge(basic_block bb, int mark);
+	void mark_edge(basic_block bb);
 
 	// rank definition
 	void rank_collective(function *fun);
diff --git a/src/pass_mpi_collective.cpp b/src/pass_mpi_collective.cpp
index 979a6db14e5a4e49c7876d28ab307cb579ace6fa..3e8640e365ed0861fd71663def7c8482f1d62def 100644
--- a/src/pass_mpi_collective.cpp
+++ b/src/pass_mpi_collective.cpp
@@ -64,8 +64,6 @@ unsigned int pass_mpi_collective::execute(function *fun)
 	alloc_edge_aux(fun);
 
 	mark_edge(fun);
-	reset_bb_mark(fun);
-
 	rank_collective(fun);
 
 	cfgviz_dump(fun, "_split");
@@ -401,30 +399,25 @@ void pass_mpi_collective::free_edge_aux(function *fun)
 
 void pass_mpi_collective::mark_edge(function *fun)
 {
-	mark_edge(ENTRY_BLOCK_PTR_FOR_FN(fun), 1);
+	mark_edge(ENTRY_BLOCK_PTR_FOR_FN(fun));
 }
 
-void pass_mpi_collective::mark_edge(basic_block bb, int mark)
+void pass_mpi_collective::mark_edge(basic_block bb)
 {
 	edge e;
 	edge_iterator ei;
-	basic_block bb_dest;
-	int dest_mark;
 
-	((bb_data *) bb->aux)->mark = mark;
+	((bb_data *) bb->aux)->mark = 1;
 	FOR_EACH_EDGE(e, ei, bb->succs)
 	{
-		bb_dest = e->dest;
-		dest_mark = ((bb_data *) bb_dest->aux)->mark;
-		if (dest_mark > 0 && dest_mark < mark)
+		if (((bb_data *) e->dest->aux)->mark)
 		{
 			((edge_data *) e->aux)->loop = true;
-		}
-		if (((bb_data *) bb_dest->aux)->mark == 0)
-		{
-			mark_edge(bb_dest, mark + 1);
+		} else {
+			mark_edge(e->dest);
 		}
 	}
+	((bb_data *) bb->aux)->mark = 0;
 }
 
 void pass_mpi_collective::rank_collective(function *fun)