diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-04-19 16:14:32 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-04-19 16:24:00 +0300 |
commit | 159a1d082a34393a29847329e0a0f1861e6eedbd (patch) | |
tree | ba182d40d2319cb688e23ab6f4722294ca4b3323 | |
parent | 5ca688150c660c580795662c996dbab887574d75 (diff) |
Do not attempt to selection merge to existing ladder blocks.
-rw-r--r-- | cfg_structurizer.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cfg_structurizer.cpp b/cfg_structurizer.cpp index b84fa6b..46377f8 100644 --- a/cfg_structurizer.cpp +++ b/cfg_structurizer.cpp @@ -2716,6 +2716,14 @@ void CFGStructurizer::find_selection_merges(unsigned pass) idom = header; } + // Similar, but also check if we have associated ladder blocks with the idom. + if (!idom->pred_back_edge) + { + auto *inner_loop_header = entry_block->get_innermost_loop_header_for(idom); + if (inner_loop_header && inner_loop_header->loop_ladder_block == node) + idom = const_cast<CFGNode *>(inner_loop_header); + } + if (pass == 0) { // Check that we're not merging ourselves into the aether. @@ -2817,7 +2825,7 @@ void CFGStructurizer::find_selection_merges(unsigned pass) //LOGI("Loop merge: %p (%s) -> %p (%s)\n", static_cast<const void *>(loop), loop->name.c_str(), // static_cast<const void *>(node), node->name.c_str()); } - else if (idom->loop_merge_block != node) + else if (idom->loop_merge_block != node && idom->loop_ladder_block != node) { auto *selection_idom = create_helper_succ_block(idom); // If we split the loop header into the loop header -> selection merge header, |