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: [patch] flow.c: Don't call sets_cc0_p if insn is NULL_RTX.


Hi,

> On Thu, Jul 19, 2001 at 03:03:35PM -0700, Kazu Hirata wrote:
> > 	* flow.c (try_redirect_by_replacing_jump): Don't call sets_cc0_p
> > 	if insn is NULL_RTX.
> 
> Hm.. I think better is to use
> 
> 	reg_mentioned_p (cc0_rtx, PATTERN (insn))
> 
> on the jump insn instead of using sets_cc0_p on the
> previous insn.

Do you mean something like the attached patch?

Does a basic block ever end with a cc0 setter without a jump_insn?  If
not, we can remove the "else if" part of the patch.

Somebody (probably Jeff Law) told me that a cc0 setter and a jump_insn
stick together until some pass, which I forgot.  By the way, I am
seeing a segfault in the sibcall pass without the patch.

Tested on the h8300 port.

Kazu Hirata

Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.430
diff -c -3 -p -r1.430 flow.c
*** flow.c	2001/07/18 17:11:10	1.430
--- flow.c	2001/07/20 02:24:45
*************** try_redirect_by_replacing_jump (e, targe
*** 1732,1742 ****
  #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
--- 1732,1744 ----
  #ifdef HAVE_cc0
    insn = src->end;
    if (GET_CODE (insn) == JUMP_INSN)
      {
!       if (reg_mentioned_p (cc0_rtx, PATTERN (insn)))
! 	flow_delete_insn (prev_nonnote_insn (insn));
!     }
!   else if (sets_cc0_p (insn))
!     {
!       src->end = PREV_INSN (insn);
        flow_delete_insn (insn);
      }
  #endif



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