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]
Other format: [Raw text]

[3.3/mainline] Fix PR/11640 (version 2)


Hi,

this patch fixes PR/11640 by moving the jump immediatelly before BARRIER
after possible notes.

Bootstrapped/regtested ppc64 and x86-64.
OK for mainline and 3.3 branch?

Josef

2003-09-14  Josef Zlomek  <zlomekj@suse.cz>

	* cfgrtl.c (try_redirect_by_replacing_jump): Move jump
	immediatelly before BARRIER.

Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/cfgrtl.c,v
retrieving revision 1.59.2.11
diff -c -3 -p -r1.59.2.11 cfgrtl.c
*** cfgrtl.c	9 Sep 2003 20:32:02 -0000	1.59.2.11
--- cfgrtl.c	14 Sep 2003 08:47:54 -0000
*************** try_redirect_by_replacing_jump (e, targe
*** 765,770 ****
--- 765,794 ----
        barrier = next_nonnote_insn (src->end);
        if (!barrier || GET_CODE (barrier) != BARRIER)
  	emit_barrier_after (src->end);
+       else
+ 	{
+ 	  if (barrier != NEXT_INSN (src->end))
+ 	    {
+ 	      /* Move the jump before barrier so that the notes
+ 		 which originally were or were created before jump table are
+ 		 inside the basic block.  */
+ 	      rtx new_insn = src->end;
+ 	      rtx tmp;
+ 
+ 	      for (tmp = NEXT_INSN (src->end); tmp != barrier;
+ 		   tmp = NEXT_INSN (tmp))
+ 		set_block_for_insn (tmp, src);
+ 
+ 	      NEXT_INSN (PREV_INSN (new_insn)) = NEXT_INSN (new_insn);
+ 	      PREV_INSN (NEXT_INSN (new_insn)) = PREV_INSN (new_insn);
+ 
+ 	      NEXT_INSN (new_insn) = barrier;
+ 	      NEXT_INSN (PREV_INSN (barrier)) = new_insn;
+ 
+ 	      PREV_INSN (new_insn) = PREV_INSN (barrier);
+ 	      PREV_INSN (barrier) = new_insn;
+ 	    }
+ 	}
      }
  
    /* Keep only one edge out and set proper flags.  */


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