diff mbox

[1/8] change a few rtx_insn * to rtx_jump_insn *

Message ID 20160914192126.2287-2-tbsaunde+gcc@tbsaunde.org
State New
Headers show

Commit Message

tbsaunde+gcc@tbsaunde.org Sept. 14, 2016, 7:21 p.m. UTC
From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2016-09-06  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* bb-reorder.c (fix_crossing_unconditional_branches): Make type
	of jump_insn rtx_jump_insn *.
	* reorg.c (steal_delay_list_from_target): Make type of insn
	rtx_jump_insn *.
	(follow_jumps): Make type of jump rtx_jump_insn *.
---
 gcc/bb-reorder.c |  5 ++---
 gcc/reorg.c      | 12 ++++++------
 2 files changed, 8 insertions(+), 9 deletions(-)

Comments

Kaz Kojima Sept. 15, 2016, 4:04 a.m. UTC | #1
tbsaunde+gcc@tbsaunde.org wrote:
> @@ -2201,8 +2201,7 @@ fix_crossing_unconditional_branches (void)
>  		{
>  		  if (!BARRIER_P (cur_insn))
>  		    BLOCK_FOR_INSN (cur_insn) = cur_bb;
> -		  if (JUMP_P (cur_insn))
> -		    jump_insn = cur_insn;
> +		  jump_insn = dyn_cast<rtx_jump_insn *> (cur_insn);
>  		}

This hunk results several new failures for tree-profile tests on SH.
If the line "if (JUMP_P (cur_insn))" is restored, those failures
go away.

Regards,
	kaz
Trevor Saunders Sept. 15, 2016, 4:31 a.m. UTC | #2
On Thu, Sep 15, 2016 at 01:04:04PM +0900, Kaz Kojima wrote:
> tbsaunde+gcc@tbsaunde.org wrote:
> > @@ -2201,8 +2201,7 @@ fix_crossing_unconditional_branches (void)
> >  		{
> >  		  if (!BARRIER_P (cur_insn))
> >  		    BLOCK_FOR_INSN (cur_insn) = cur_bb;
> > -		  if (JUMP_P (cur_insn))
> > -		    jump_insn = cur_insn;
> > +		  jump_insn = dyn_cast<rtx_jump_insn *> (cur_insn);
> >  		}
> 
> This hunk results several new failures for tree-profile tests on SH.
> If the line "if (JUMP_P (cur_insn))" is restored, those failures
> go away.

That's interesting because dyn_cast should include that check.  What is
the error?

Thanks!

Trev

> 
> Regards,
> 	kaz
Kaz Kojima Sept. 15, 2016, 4:32 a.m. UTC | #3
Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
>> This hunk results several new failures for tree-profile tests on SH.
>> If the line "if (JUMP_P (cur_insn))" is restored, those failures
>> go away.
> 
> That's interesting because dyn_cast should include that check.  What is
> the error?

Here is a typical log:

spawn -ignore SIGHUP /home/ldroot/dodes/xsh-gcc/gcc/xgcc -B/home/ldroot/dodes/xsh-gcc/gcc/ /exp/ldroot/dodes/LOCAL/trunk/gcc/testsuite/gcc.dg/tree-prof/20041218-1.c -fno-diagnostics-show-caret -fdiagnostics-color=never -O2 -freorder-blocks-and-partition -fprofile-use -D_PROFILE_USE -lm -o /home/ldroot/dodes/xsh-gcc/gcc/testsuite/gcc/20041218-1.x02
/exp/ldroot/dodes/LOCAL/trunk/gcc/testsuite/gcc.dg/tree-prof/20041218-1.c: In function 'check':
/exp/ldroot/dodes/LOCAL/trunk/gcc/testsuite/gcc.dg/tree-prof/20041218-1.c:55:1: internal compiler error: Segmentation fault
0x86cd24a crash_signal
	../../LOCAL/trunk/gcc/toplev.c:336
0x8b4cf5e fix_crossing_unconditional_branches
	../../LOCAL/trunk/gcc/bb-reorder.c:2214
0x8b4e18a execute
	../../LOCAL/trunk/gcc/bb-reorder.c:2933

Regards,
	kaz
Richard Biener Sept. 15, 2016, 8:28 a.m. UTC | #4
On Thu, Sep 15, 2016 at 6:31 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> On Thu, Sep 15, 2016 at 01:04:04PM +0900, Kaz Kojima wrote:
>> tbsaunde+gcc@tbsaunde.org wrote:
>> > @@ -2201,8 +2201,7 @@ fix_crossing_unconditional_branches (void)
>> >             {
>> >               if (!BARRIER_P (cur_insn))
>> >                 BLOCK_FOR_INSN (cur_insn) = cur_bb;
>> > -             if (JUMP_P (cur_insn))
>> > -               jump_insn = cur_insn;
>> > +             jump_insn = dyn_cast<rtx_jump_insn *> (cur_insn);
>> >             }
>>
>> This hunk results several new failures for tree-profile tests on SH.
>> If the line "if (JUMP_P (cur_insn))" is restored, those failures
>> go away.
>
> That's interesting because dyn_cast should include that check.  What is
> the error?

maybe jump_insn is non-NULL before?  in which case you set it to NULL
if ! JUMP_P while before we didn't.

Richard.

> Thanks!
>
> Trev
>
>>
>> Regards,
>>       kaz
Trevor Saunders Sept. 15, 2016, 9:24 a.m. UTC | #5
On Thu, Sep 15, 2016 at 10:28:19AM +0200, Richard Biener wrote:
> On Thu, Sep 15, 2016 at 6:31 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> > On Thu, Sep 15, 2016 at 01:04:04PM +0900, Kaz Kojima wrote:
> >> tbsaunde+gcc@tbsaunde.org wrote:
> >> > @@ -2201,8 +2201,7 @@ fix_crossing_unconditional_branches (void)
> >> >             {
> >> >               if (!BARRIER_P (cur_insn))
> >> >                 BLOCK_FOR_INSN (cur_insn) = cur_bb;
> >> > -             if (JUMP_P (cur_insn))
> >> > -               jump_insn = cur_insn;
> >> > +             jump_insn = dyn_cast<rtx_jump_insn *> (cur_insn);
> >> >             }
> >>
> >> This hunk results several new failures for tree-profile tests on SH.
> >> If the line "if (JUMP_P (cur_insn))" is restored, those failures
> >> go away.
> >
> > That's interesting because dyn_cast should include that check.  What is
> > the error?
> 
> maybe jump_insn is non-NULL before?  in which case you set it to NULL
> if ! JUMP_P while before we didn't.

Oh wow, I missed that this  assignment was in a loop not an iff :(
makes sense now and easy enough to fix up.

Trev

> 
> Richard.
> 
> > Thanks!
> >
> > Trev
> >
> >>
> >> Regards,
> >>       kaz
diff mbox

Patch

diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index bb8435f..b26c041 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2146,7 +2146,7 @@  fix_crossing_unconditional_branches (void)
   rtx label;
   rtx label_addr;
   rtx_insn *indirect_jump_sequence;
-  rtx_insn *jump_insn = NULL;
+  rtx_jump_insn *jump_insn = NULL;
   rtx new_reg;
   rtx_insn *cur_insn;
   edge succ;
@@ -2201,8 +2201,7 @@  fix_crossing_unconditional_branches (void)
 		{
 		  if (!BARRIER_P (cur_insn))
 		    BLOCK_FOR_INSN (cur_insn) = cur_bb;
-		  if (JUMP_P (cur_insn))
-		    jump_insn = cur_insn;
+		  jump_insn = dyn_cast<rtx_jump_insn *> (cur_insn);
 		}
 
 	      /* Insert the new (indirect) jump sequence immediately before
diff --git a/gcc/reorg.c b/gcc/reorg.c
index c58d608..d798c6a 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -205,7 +205,7 @@  static int redirect_with_delay_slots_safe_p (rtx_insn *, rtx, rtx);
 static int redirect_with_delay_list_safe_p (rtx_insn *, rtx,
 					    const vec<rtx_insn *> &);
 static int check_annul_list_true_false (int, const vec<rtx_insn *> &);
-static void steal_delay_list_from_target (rtx_insn *, rtx, rtx_sequence *,
+static void steal_delay_list_from_target (rtx_jump_insn *, rtx, rtx_sequence *,
 					  vec<rtx_insn *> *,
 					  struct resources *,
 					  struct resources *,
@@ -1033,10 +1033,10 @@  check_annul_list_true_false (int annul_true_p,
    execution should continue.  */
 
 static void
-steal_delay_list_from_target (rtx_insn *insn, rtx condition, rtx_sequence *seq,
-			      vec<rtx_insn *> *delay_list, resources *sets,
-			      struct resources *needed,
-			      struct resources *other_needed,
+steal_delay_list_from_target (rtx_jump_insn *insn, rtx condition,
+			      rtx_sequence *seq, vec<rtx_insn *> *delay_list,
+			      resources *sets, resources *needed,
+			      resources *other_needed,
 			      int slots_to_fill, int *pslots_filled,
 			      int *pannul_p, rtx *pnew_thread)
 {
@@ -2265,7 +2265,7 @@  fill_simple_delay_slots (int non_jumps_p)
    set *CROSSING to true, otherwise set it to false.  */
 
 static rtx
-follow_jumps (rtx label, rtx_insn *jump, bool *crossing)
+follow_jumps (rtx label, rtx_jump_insn *jump, bool *crossing)
 {
   rtx_insn *insn;
   rtx_insn *next;