From 9478d86e9bcb85a14f1df389ff038f1c0c7cee94 Mon Sep 17 00:00:00 2001 From: "nicolas.marie" <nicolas.marie@ensiie.eu> Date: Fri, 13 Oct 2023 23:53:29 +0200 Subject: [PATCH] fixe loop detection system --- include/pass_mpi_collective.hpp | 2 +- src/pass_mpi_collective.cpp | 21 +++++++-------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/include/pass_mpi_collective.hpp b/include/pass_mpi_collective.hpp index e381811..44d96f7 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 979a6db..3e8640e 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) -- GitLab