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]

Re: Recent Change to gcc/flow.c Causes Test Regression for 3.1


> This morning, gcc/testsuite/gcc.dg/wtr-label-1.c regressed with the
> following problem:
> 
> ~/gcc/gcc2/objdir/gcc/cc1 wtr-label-1.i 
>  testfunc1
> /nfs/oz/home/oldham/gcc/gcc2/gcc/testsuite/gcc.dg/wtr-label-1.c: In function `testfunc1':
> /nfs/oz/home/oldham/gcc/gcc2/gcc/testsuite/gcc.dg/wtr-label-1.c:29: Virtual array basic_block_info[1]: element 1 out of bounds
> /nfs/oz/home/oldham/gcc/gcc2/gcc/testsuite/gcc.dg/wtr-label-1.c:29: confused by earlier errors, bailing out
> 
> The problem disappears when reversing your most recent change to
> gcc/flow.c, i.e., revision 1.412, which is attached.  I am using
> i686-pc-linux-gnu and gcc 3.1.
> 
> Would you be willing to fix the problem?
Yes, but I am away now, so I can do it after 7th.
I believe I know where the problem is, so maybe I will be able to send
patch before that.

Honza
> 
> Thanks,
> Jeffrey D. Oldham
> oldham@codesourcery.com
> Index: flow.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/flow.c,v
> retrieving revision 1.411
> retrieving revision 1.412
> diff -c -p -r1.411 -r1.412
> *** flow.c	2001/07/02 16:47:57	1.411
> --- flow.c	2001/07/02 21:16:48	1.412
> *************** static bool
> *** 1597,1614 ****
>   forwarder_block_p (bb)
>        basic_block bb;
>   {
> !   rtx insn;
>     if (bb == EXIT_BLOCK_PTR || bb == ENTRY_BLOCK_PTR
>         || !bb->succ || bb->succ->succ_next)
>       return false;
>   
> !   insn = next_active_insn (bb->head);
> !   if (!insn)
> !     return false;
> !   if (GET_CODE (insn) == CODE_LABEL
> !       || (GET_CODE (insn) == JUMP_INSN && onlyjump_p (insn)))
> !     return true;
> !   return false;
>   }
>   
>   /* Return nonzero if we can reach target from src by falling trought.  */
> --- 1597,1615 ----
>   forwarder_block_p (bb)
>        basic_block bb;
>   {
> !   rtx insn = bb->head;
>     if (bb == EXIT_BLOCK_PTR || bb == ENTRY_BLOCK_PTR
>         || !bb->succ || bb->succ->succ_next)
>       return false;
>   
> !   while (insn != bb->end)
> !     {
> !       if (active_insn_p (insn))
> ! 	return false;
> !       insn = NEXT_INSN (insn);
> !     }
> !   return (!active_insn_p (insn)
> ! 	  || (GET_CODE (insn) == JUMP_INSN && onlyjump_p (insn)));
>   }
>   
>   /* Return nonzero if we can reach target from src by falling trought.  */
> *************** try_redirect_by_replacing_jump (e, targe
> *** 1699,1704 ****
> --- 1700,1707 ----
>       e->flags = EDGE_FALLTHRU;
>     else
>       e->flags = 0;
> +   e->probability = REG_BR_PROB_BASE;
> +   e->count = src->count;
>   
>     /* Fixup barriers.  */
>     barrier = next_nonnote_insn (insn);
> *************** try_redirect_by_replacing_jump (e, targe
> *** 1707,1712 ****
> --- 1710,1729 ----
>     else if (!fallthru && GET_CODE (barrier) != BARRIER)
>       emit_barrier_after (insn);
>   
> +   /* In case we've zapped an conditional jump, we need to kill the cc0
> +      setter too if available.  */
> + #ifdef HAVE_cc0
> +   insn = src->end;
> +   if (GET_CODE (insn) == JUMP_INSN)
> +     insn = prev_nonnote_insn (insn);
> +   if (sets_cc0_p (insn))
> +     {
> +       if (insn == src->end)
> + 	src->end = PREV_INSN (insn);
> +       flow_delete_insn (insn);
> +     }
> + #endif
> + 
>     if (e->dest != target)
>       redirect_edge_succ (e, target);
>     return true;
> *************** redirect_edge_and_branch (e, target)
> *** 1766,1772 ****
>         for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j)
>   	if (XEXP (RTVEC_ELT (vec, j), 0) == old_label)
>   	  {
> ! 	    RTVEC_ELT (vec, j) = gen_rtx_LABEL_REF (VOIDmode, new_label);
>   	    --LABEL_NUSES (old_label);
>   	    ++LABEL_NUSES (new_label);
>   	  }
> --- 1783,1789 ----
>         for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j)
>   	if (XEXP (RTVEC_ELT (vec, j), 0) == old_label)
>   	  {
> ! 	    RTVEC_ELT (vec, j) = gen_rtx_LABEL_REF (Pmode, new_label);
>   	    --LABEL_NUSES (old_label);
>   	    ++LABEL_NUSES (new_label);
>   	  }
> *************** redirect_edge_and_branch (e, target)
> *** 1815,1820 ****
> --- 1832,1839 ----
>         if (s)
>   	{
>   	  s->flags |= e->flags;
> + 	  s->probability += e->probability;
> + 	  s->count += e->count;
>   	  remove_edge (e);
>   	}
>         else


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