From 337608578bf8b781b5ffd077cde7553dd71d54b3 Mon Sep 17 00:00:00 2001 From: "nicolas.marie" <nicolas.marie@ensiie.eu> Date: Tue, 10 Oct 2023 09:49:38 +0200 Subject: [PATCH] fixe split_block function --- src/pass_mpi_collective.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/pass_mpi_collective.cpp b/src/pass_mpi_collective.cpp index 713adc7..da75c71 100644 --- a/src/pass_mpi_collective.cpp +++ b/src/pass_mpi_collective.cpp @@ -134,18 +134,25 @@ void pass_mpi_collective::split_blocks(function *fun) basic_block bb; gimple_stmt_iterator gsi; gimple *stmt; + gimple *prev_stmt; size_t nb_collective; + bool split; FOR_EACH_BB_FN(bb, fun) { nb_collective = 0; - for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) + stmt = NULL; + split = false; + for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi) && ! split; gsi_next(&gsi)) { + prev_stmt = stmt; stmt = gsi_stmt(gsi); if (is_mpi_collec(stmt) != LAST_AND_UNUSED_MPI_COLLECTIVE_CODE) - { ++nb_collective; } - if (nb_collective >= 2) - { split_block(bb, stmt); } + ++nb_collective; + if (nb_collective >= 2){ + split_block(bb, prev_stmt); + split = true; + } } } } -- GitLab