diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-04-04 15:08:35 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-04-04 17:30:03 +0300 |
commit | e03c47b67d42563a2d2c535aa57b477c7e0814d4 (patch) | |
tree | 4b65627d7310f9c432e643682e8c987b54cd8af5 | |
parent | fb085543370ac95ffa422f9547687b46088fed8b (diff) |
Add assertion check for impossible loop merge scenario.
-rw-r--r-- | cfg_structurizer.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cfg_structurizer.cpp b/cfg_structurizer.cpp index b603b07..464a36e 100644 --- a/cfg_structurizer.cpp +++ b/cfg_structurizer.cpp @@ -3306,6 +3306,19 @@ void CFGStructurizer::find_loops() node->loop_ladder_block = dominated_merge; } } + + if (node->loop_merge_block && node->loop_ladder_block && !non_dominated_exit.empty()) + { + // We might have a horribly complex scenario where a loop breaks, but it breaks to an outer scope + // which is not consistent with the merge block. + // When we split merge scopes, we need to specially consider any header that dominates this common break target. + auto *common_break_target = find_common_post_dominator(non_dominated_exit); + if (common_break_target && common_break_target != node->loop_merge_block && + common_break_target->reaches_domination_frontier_before_merge(node->loop_merge_block)) + { + LOGE("FIXME: Impossible loop merge detected.\n"); + } + } } } } |