[Bug gcov-profile/59527] [4.9 Regression] ICE: in fixup_reorder_chain, at cfgrtl.c:3739 during PGO Firefox build

tejohnson at google dot com gcc-bugzilla@gcc.gnu.org
Tue Dec 17 14:44:00 GMT 2013


--- Comment #3 from Teresa Johnson <tejohnson at google dot com> ---
On Mon, Dec 16, 2013 at 10:41 AM, Teresa Johnson <tejohnson@google.com> wrote:
> I will take a look and report back. -freorder-blocks-and-partition was
> recently enabled by default, which presumably exposed this issue.

The issue is that there is a region crossing branch that cannot be
optimized away (since it is needed to cross the region boundary), and
fixup_reorder_chain was not handling this case. In the case where
there was 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. In this case 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.

This routine 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

Here is the patch that fixes the issue, regression testing in progress:

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

        * 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);


> Thanks,
> Teresa
> On Mon, Dec 16, 2013 at 8:21 AM, octoploid at yandex dot com
> <gcc-bugzilla@gcc.gnu.org> wrote:
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59527
>> --- Comment #1 from Markus Trippelsdorf <octoploid at yandex dot com> ---
>> Created attachment 31447
>>   --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31447&action=edit
>> unreduced testcase
>>  % g++ -w -r -nostdlib -fprofile-use -fprofile-correction -march=amdfam10
>> -fno-exceptions -std=gnu++0x -O3 test.ii
>> In file included from /var/tmp/moz-build-dir/js/src/Unified_cpp_9.cpp:101:0:
>> /var/tmp/mozilla-central/js/src/vm/Stack.cpp: In member function
>> ‘js::ScriptFrameIter& js::ScriptFrameIter::operator++()’:
>> /var/tmp/mozilla-central/js/src/vm/Stack.cpp:717:1: internal compiler error: in
>> fixup_reorder_chain, at cfgrtl.c:3739
>> --
>> You are receiving this mail because:
>> You are on the CC list for the bug.
> --
> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413

More information about the Gcc-bugs mailing list