This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Fix PR 59527 (assert in cfg fixup with function splitting)


Add handling to fixup_reorder_chain for a region crossing branch, which
cannot be optimized away (since it is needed to cross the region boundary).
In the case when there is no fallthru for a conditional jump the comments
indicate that this can happen if the conditional jump has side effects and
can't be deleted, in which case a barrier is inserted and no change is
made to the branch. Here, since the branch is region crossing,
it also cannot be eliminated, but the assert was not handling that
case. I fixed by simply adding a check for it to the assert.

fixup_reorder_chain already has some handling for region-crossing branches,
but it was only handling the case where there was both a taken and
fallthru edge. In this case we had no fallthru. The reason was that
the fallthru had been eliminated in an earlier round of cfg
optimizations when going in/out of cfglayout mode during
pro_and_epilogue. The fallthru was an empty block that appears to be
due to switch expansion with the case having a __builtin_unreachable().

Bootstrapped and tested on x86_64-unknown-linux-gnu. Ok for trunk?

2013-12-17  Teresa Johnson  <tejohnson@google.com>

        PR gcov-profile/59527
        * cfgrtl.c (fixup_reorder_chain): Handle a region-crossing
        branch, which can't be eliminated.

Index: cfgrtl.c
===================================================================
--- cfgrtl.c    (revision 206033)
+++ cfgrtl.c    (working copy)
@@ -3736,7 +3736,8 @@ fixup_reorder_chain (void)
              if (!e_fall)
                {
                  gcc_assert (!onlyjump_p (bb_end_insn)
-                             || returnjump_p (bb_end_insn));
+                             || returnjump_p (bb_end_insn)
+                              || (e_taken->flags & EDGE_CROSSING));
                  emit_barrier_after (bb_end_insn);
                  continue;
                }


-- 
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]