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]

jump-to-next buglet


Exposed by ppc regrssion testing (execute/920501-1.c).

The problem is that the jump-to-next-insn optimization uses next_active_insn
to decide if we're jumping to the next insn.  After reload, this does not
include USE or CLOBBER insns.  We proceed to transform

	(insn (set r3 (const_int 1)))
	(jump_insn (set (pc) (label_ref 47)))
	(code_label 42)
	(insn (clobber r3))
	(code_label 47)
	(insn (use r3))

into 

	(insn (set r3 (const_int 1)))
	(insn (clobber r3))
	(insn (use r3))

which flow2 helpfully simplifies to 

	(insn (use r3))

By removing the inactive insns, we avoid this problem.

There may be other similar cases lurking in this code; it's hard to
tell.  All the more reason to nuke it as fast as possible.


r~

        * jump.c (jump_optimize_1): Remove inactive but real insns
        in jump-to-next-insn optimization.

Index: jump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/jump.c,v
retrieving revision 1.124
diff -c -p -d -r1.124 jump.c
*** jump.c	2000/05/17 01:44:03	1.124
--- jump.c	2000/05/17 21:01:16
*************** jump_optimize_1 (f, cross_jump, noop_mov
*** 390,395 ****
--- 390,402 ----
  	    {
  	      next = next_real_insn (JUMP_LABEL (insn));
  	      delete_jump (insn);
+ 
+ 	      /* Remove the "inactive" but "real" insns (i.e. uses and
+ 	         clobbers) in between here and there.  */
+ 	      temp = insn;
+ 	      while ((temp = next_real_insn (temp)) != next)
+ 		delete_insn (temp);
+ 
  	      changed = 1;
  	      continue;
  	    }

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