https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109596

--- Comment #19 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I looked into the remaining exit/nonexit rename discussed here earlier before
the PR was closed. The following patch would restore the code to do the same
calls as before my patch
        PR tree-optimization/109596
        * tree-ssa-loop-ch.c (ch_base::copy_headers): Fix use of exit/nonexit
edges.
diff --git a/gcc/tree-ssa-loop-ch.cc b/gcc/tree-ssa-loop-ch.cc
index b7ef485c4cc..cd5f6bc3c2a 100644
--- a/gcc/tree-ssa-loop-ch.cc
+++ b/gcc/tree-ssa-loop-ch.cc
@@ -952,13 +952,13 @@ ch_base::copy_headers (function *fun)
       if (!single_pred_p (nonexit->dest))
        {
          header = split_edge (nonexit);
-         exit = single_pred_edge (header);
+         nonexit = single_pred_edge (header);
        }

       edge entry = loop_preheader_edge (loop);

       propagate_threaded_block_debug_into (nonexit->dest, entry->dest);
-      if (!gimple_duplicate_seme_region (entry, exit, bbs, n_bbs, copied_bbs,
+      if (!gimple_duplicate_seme_region (entry, nonexit, bbs, n_bbs,
copied_bbs,
                                         true))
        {
          delete candidate.static_exits;

I however convinced myself this is an noop. both exit and nonexit sources have
same basic blocks.  

propagate_threaded_block_debug_into walks predecessors of its first parameter
and moves debug statements to the second parameter, so it does the same job,
since the split BB is empty.

gimple_duplicate_seme_region uses the parametr to update loop header but it
does not do that correctly for loop header copying and we re-do it in
tree-ssa-loop-ch.

Still the code as it is now in trunk is very confusing, so perhaps we should
update it?

Reply via email to