public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/58220] New: [4.9 Regression] Many new failures for SH after rev. 201833
@ 2013-08-22 23:26 kkojima at gcc dot gnu.org
2013-08-24 8:48 ` [Bug rtl-optimization/58220] " kkojima at gcc dot gnu.org
2013-11-23 4:30 ` tejohnson at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: kkojima at gcc dot gnu.org @ 2013-08-22 23:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58220
Bug ID: 58220
Summary: [4.9 Regression] Many new failures for SH after rev.
201833
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: kkojima at gcc dot gnu.org
Target: sh*-*-*
There are many new execution errors on SH after the revision 201833
r201883 | tejohnson | 2013-08-20 22:29:53 +0900 (Tue, 20 Aug 2013) | 8 lines
The change of final.c:reemit_insn_block_notes for r201883
...
- for (; insn; insn = next_active_insn (insn))
+ for (; insn; insn = next_insn (insn))
{
tree this_block;
+ /* Prevent lexical blocks from straddling section boundaries. */
+ if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_SWITCH_TEXT_SECTIONS)
+ {
+ for (tree s = cur_block; s != DECL_INITIAL (cfun->decl);
+ s = BLOCK_SUPERCONTEXT (s))
+ {
+ rtx note = emit_note_before (NOTE_INSN_BLOCK_END, insn);
+ NOTE_BLOCK (note) = s;
+ note = emit_note_after (NOTE_INSN_BLOCK_BEG, insn);
+ NOTE_BLOCK (note) = s;
+ }
+ }
+
+ if (!active_insn_p (insn))
+ continue;
uses next_insn and active_insn_p pair instead of next_acrive_insn,
though next_insn handles SEQUENCEs specially:
rtx
next_insn (rtx insn)
{
if (insn)
{
insn = NEXT_INSN (insn);
if (insn && NONJUMP_INSN_P (insn)
&& GET_CODE (PATTERN (insn)) == SEQUENCE)
insn = XVECEXP (PATTERN (insn), 0, 0);
}
return insn;
}
but next_active_insn does nothing special for SEQUENCEs:
rtx
next_active_insn (rtx insn)
{
while (insn)
{
insn = NEXT_INSN (insn);
if (insn == 0 || active_insn_p (insn))
break;
}
return insn;
}
It looks now the for loop in reemit_insn_block_notes sees the inside
insn of SEQUENCE, not SEQUENCE insn itself. The failures went away
with the following one liner.
* final.c (reemit_insn_block_notes): Use NEXT_INSN instead of
next_insn.
--- ORIG/trunk/gcc/final.c 2013-08-22 09:43:35.000000000 +0900
+++ trunk/gcc/final.c 2013-08-22 14:36:51.000000000 +0900
@@ -1650,7 +1650,7 @@ reemit_insn_block_notes (void)
rtx insn, note;
insn = get_insns ();
- for (; insn; insn = next_insn (insn))
+ for (; insn; insn = NEXT_INSN (insn))
{
tree this_block;
Here is the diff of the generated codes with/without the above patch
for a typical example of failure gcc.c-torture/execute/20000422-1.c
with -Og -g:
--- good.s 2013-08-23 07:47:43.000000000 +0900
+++ bad.s 2013-08-23 07:47:16.000000000 +0900
@@ -27,6 +27,7 @@ main:
.LBE2:
.loc 1 17 0
bra .L2
+ nop
mov #0,r4
.LVL1:
.align 1
where SH uses a SEQUENCE for bra instruction and its delayed slot
which should be filled with nop in this case.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/58220] [4.9 Regression] Many new failures for SH after rev. 201833
2013-08-22 23:26 [Bug rtl-optimization/58220] New: [4.9 Regression] Many new failures for SH after rev. 201833 kkojima at gcc dot gnu.org
@ 2013-08-24 8:48 ` kkojima at gcc dot gnu.org
2013-11-23 4:30 ` tejohnson at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: kkojima at gcc dot gnu.org @ 2013-08-24 8:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58220
Kazumoto Kojima <kkojima at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #1 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
Fixed at r201941.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug rtl-optimization/58220] [4.9 Regression] Many new failures for SH after rev. 201833
2013-08-22 23:26 [Bug rtl-optimization/58220] New: [4.9 Regression] Many new failures for SH after rev. 201833 kkojima at gcc dot gnu.org
2013-08-24 8:48 ` [Bug rtl-optimization/58220] " kkojima at gcc dot gnu.org
@ 2013-11-23 4:30 ` tejohnson at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: tejohnson at gcc dot gnu.org @ 2013-11-23 4:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58220
--- Comment #2 from tejohnson at gcc dot gnu.org ---
Author: tejohnson
Date: Sat Nov 23 04:30:07 2013
New Revision: 205298
URL: http://gcc.gnu.org/viewcvs?rev=205298&root=gcc&view=rev
Log:
Backport to google/4_8 new sanity checking and some dwarf emission fixes for
-freorder-blocks-and-partition from trunk (r201883, r201941, r202125).
------------------------------------------------------------------------
r201883 | tejohnson | 2013-08-20 06:29:53 -0700 (Tue, 20 Aug 2013) | 8 lines
Changed paths:
M /trunk/gcc/ChangeLog
M /trunk/gcc/final.c
M /trunk/gcc/testsuite/ChangeLog
A /trunk/gcc/testsuite/g++.dg/tree-prof/pr57451.C
2013-08-20 Teresa Johnson <tejohnson@google.com>
PR rtl-optimizations/57451
* final.c (reemit_insn_block_notes): Prevent lexical blocks
from crossing split section boundaries.
* testsuite/g++.dg/tree-prof/pr57451.C: New test.
------------------------------------------------------------------------
------------------------------------------------------------------------
r201941 | tejohnson | 2013-08-23 07:31:06 -0700 (Fri, 23 Aug 2013) | 7 lines
Changed paths:
M /trunk/gcc/ChangeLog
M /trunk/gcc/final.c
2013-08-23 Kaz Kojima <kkojima@gcc.gnu.org>
PR rtl-optimization/58220
PR regression/58221
* final.c (reemit_insn_block_notes): Use NEXT_INSN to
handle SEQUENCE insns properly.
------------------------------------------------------------------------
------------------------------------------------------------------------
r202125 | tejohnson | 2013-08-30 18:43:33 -0700 (Fri, 30 Aug 2013) | 30 lines
Changed paths:
M /trunk/gcc/ChangeLog
M /trunk/gcc/basic-block.h
M /trunk/gcc/bb-reorder.c
M /trunk/gcc/cfg.c
M /trunk/gcc/cfgcleanup.c
M /trunk/gcc/cfgrtl.c
M /trunk/gcc/predict.c
This patch sanitizes the partitioning to address issues such as edge
weight insanities that sometimes occur due to upstream optimizations,
and ensures that hot blocks are not dominated by cold blocks. This
needs to be resanitized after certain cfg optimizations that may
cause hot blocks previously reached via both hot and cold paths to
only be reached by cold paths.
The verification code in sanitize_dominator_hotness was contributed by
Steven Bosscher.
2013-08-29 Teresa Johnson <tejohnson@google.com>
Steven Bosscher <steven@gcc.gnu.org>
* cfgrtl.c (fixup_new_cold_bb): New routine.
(commit_edge_insertions): Invoke fixup_partitions.
(find_partition_fixes): New routine.
(fixup_partitions): Ditto.
(verify_hot_cold_block_grouping): Update comments.
(rtl_verify_edges): Invoke find_partition_fixes.
(rtl_verify_bb_pointers): Update comments.
(rtl_verify_bb_layout): Ditto.
* basic-block.h (probably_never_executed_edge_p): Declare.
(fixup_partitions): Ditto.
* cfgcleanup.c (try_optimize_cfg): Invoke fixup_partitions.
* bb-reorder.c (sanitize_hot_paths): New function.
(find_rarely_executed_basic_blocks_and_crossing_edges): Invoke
sanitize_hot_paths.
* predict.c (probably_never_executed_edge_p): New routine.
* cfg.c (check_bb_profile): Add partition insanity warnings.
------------------------------------------------------------------------
Added:
branches/google/gcc-4_8/gcc/testsuite/g++.dg/tree-prof/pr57451.C
Modified:
branches/google/gcc-4_8/gcc/basic-block.h
branches/google/gcc-4_8/gcc/bb-reorder.c
branches/google/gcc-4_8/gcc/cfg.c
branches/google/gcc-4_8/gcc/cfgcleanup.c
branches/google/gcc-4_8/gcc/cfgrtl.c
branches/google/gcc-4_8/gcc/final.c
branches/google/gcc-4_8/gcc/predict.c
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-23 4:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-22 23:26 [Bug rtl-optimization/58220] New: [4.9 Regression] Many new failures for SH after rev. 201833 kkojima at gcc dot gnu.org
2013-08-24 8:48 ` [Bug rtl-optimization/58220] " kkojima at gcc dot gnu.org
2013-11-23 4:30 ` tejohnson at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).