[Bug target/64761] [4.9/5 Regression] -freorder-blocks-and-partition causes some failures on SH

2015-02-09 Thread kkojima at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64761

--- Comment #5 from Kazumoto Kojima kkojima at gcc dot gnu.org ---
Author: kkojima
Date: Mon Feb  9 23:47:11 2015
New Revision: 220552

URL: https://gcc.gnu.org/viewcvs?rev=220552root=gccview=rev
Log:
PR target/64761
Replace MD_REDIRECT_BRANCH with TARGET_CAN_FOLLOW_JUMP.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/sh/sh-protos.h
trunk/gcc/config/sh/sh.c
trunk/gcc/config/sh/sh.h
trunk/gcc/doc/tm.texi
trunk/gcc/doc/tm.texi.in
trunk/gcc/reorg.c


[Bug target/64761] [4.9/5 Regression] -freorder-blocks-and-partition causes some failures on SH

2015-02-09 Thread kkojima at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64761

--- Comment #6 from Kazumoto Kojima kkojima at gcc dot gnu.org ---
Author: kkojima
Date: Tue Feb 10 00:00:54 2015
New Revision: 220553

URL: https://gcc.gnu.org/viewcvs?rev=220553root=gccview=rev
Log:
PR target/64761
[SH] Add jump insn for -freorder-blocks-and-partition.  Don't degrade
-freorder-blocks-and-partition to -freorder-blocks even when unwinding
is enabled.

* [SH] Add jump insn for -freorder-blocks-and-partition.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/sh/sh.c
trunk/gcc/config/sh/sh.md


[Bug target/64761] [4.9/5 Regression] -freorder-blocks-and-partition causes some failures on SH

2015-02-09 Thread kkojima at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64761

Kazumoto Kojima kkojima at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Kazumoto Kojima kkojima at gcc dot gnu.org ---
Fixed on trunk.


[Bug target/64761] [4.9/5 Regression] -freorder-blocks-and-partition causes some failures on SH

2015-01-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64761

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4
 CC||jakub at gcc dot gnu.org


[Bug target/64761] [4.9/5 Regression] -freorder-blocks-and-partition causes some failures on SH

2015-01-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64761

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Target Milestone|--- |4.9.3


[Bug target/64761] [4.9/5 Regression] -freorder-blocks-and-partition causes some failures on SH

2015-01-23 Thread kkojima at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64761

--- Comment #1 from Kazumoto Kojima kkojima at gcc dot gnu.org ---
Created attachment 34560
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=34560action=edit
Update of Joern's patch


[Bug target/64761] [4.9/5 Regression] -freorder-blocks-and-partition causes some failures on SH

2015-01-23 Thread kkojima at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64761

--- Comment #4 from Kazumoto Kojima kkojima at gcc dot gnu.org ---
Created attachment 34562
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=34562action=edit
patch for dbr_schedule


[Bug target/64761] [4.9/5 Regression] -freorder-blocks-and-partition causes some failures on SH

2015-01-23 Thread kkojima at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64761

--- Comment #3 from Kazumoto Kojima kkojima at gcc dot gnu.org ---
Even after these changes,

  Error: displacement to defined symbol .L59 overflows 12-bit field

remains for va-arg-pack-1.c and a new failure

  Error: displacement to defined symbol .L31 overflows 8-bit field

pops up for gcc.dg/tree-prof/20041218-1.c.
These wrong branches crossing between partitions were created by
dbr_schedule.
For va-arg-pack-1.c, it seems that relax_delay_slots in dbr_schedule
pass does a variant of follow jump optimization without checking
targetm.can_follow_jump.  The patch below fixes it.

diff --git a/reorg.c b/reorg.c
index 326fa53..2ac6dcf 100644
--- a/reorg.c
+++ b/reorg.c
@@ -3262,12 +3263,13 @@ relax_delay_slots (rtx_insn *first)

   /* See if this jump conditionally branches around an unconditional
  jump.  If so, invert this jump and point it to the target of the
- second jump.  */
+ second jump.  Check if it's possible on the target.  */
   if (next  simplejump_or_return_p (next)
any_condjump_p (insn)
target_label
next_active_insn (target_label) == next_active_insn (next)
-   no_labels_between_p (insn, next))
+   no_labels_between_p (insn, next)
+   targetm.can_follow_jump (insn, next))
 {
   rtx label = JUMP_LABEL (next);

For 20041218-1.c, relax_delay_slots deletes the jump_insn 74 bellow
as a trivial jump to the next insn ignoring that this jump is
a crossing jump between hot/cold partitions.  Notice that there
is a NOTE_INSN_SWITCH_TEXT_SECTIONS note between the jump and its
target label.

...
(jump_insn/j 74 58 59 (set (pc)
(label_ref:SI 29)) 312 {*jump_compact_crossing}
 (nil)
 - 29)
(barrier 59 74 105)
(note 105 59 29 NOTE_INSN_SWITCH_TEXT_SECTIONS)
(code_label 29 105 30 31  [5 uses])
(note 30 29 31 [bb 13] NOTE_INSN_BASIC_BLOCK)
(insn 31 30 32 (set (reg/f:SI 5 r5 [178])
(mem/u/c:SI (label_ref 108) [0  S4 A32]))
...

It seems that we should take account of crossing jumps here.  The patch

diff --git a/reorg.c b/reorg.c
index 326fa53..2ac6dcf 100644
--- a/reorg.c
+++ b/reorg.c
@@ -3247,6 +3247,7 @@ relax_delay_slots (rtx_insn *first)
 target_label = find_end_label (target_label);

   if (target_label  next_active_insn (target_label) == next
+   ! (CROSSING_JUMP_P (insn) || crossing)
! condjump_in_parallel_p (insn))
 {
   delete_jump (insn);

fixes the issue.


[Bug target/64761] [4.9/5 Regression] -freorder-blocks-and-partition causes some failures on SH

2015-01-23 Thread kkojima at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64761

--- Comment #2 from Kazumoto Kojima kkojima at gcc dot gnu.org ---
Created attachment 34561
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=34561action=edit
patch for crossing jump