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]

haifa clobber bug fix


The clobber scheduling patch I committed last week has one problem --

	(insn 100 (set (flags) ...))

	(insn 101 (set (i_t_e (flags)) ...))

	(insn 102 [(set foo ...) (clobber flags)])

	(insn 103 [(set bar ...) (clobber flags)])

Insn 102 would get a dependancy on insn 101, but insn 103 wouldn't,
which would wind up with 

	(insn 100 (set (flags) ...))

	(insn 103 [(set bar ...) (clobber flags)])

	(insn 101 (set (i_t_e (flags)) ...))

	(insn 102 [(set foo ...) (clobber flags)])

when scheduled.  :-(

This patch fixes it.



r~

	* haifa-sched.c (sched_analyze_1): Only clear reg_last_uses on a SET.

Index: haifa-sched.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/haifa-sched.c,v
retrieving revision 1.110
diff -c -p -d -r1.110 haifa-sched.c
*** haifa-sched.c	1999/03/11 01:32:01	1.110
--- haifa-sched.c	1999/03/14 01:36:39
*************** sched_analyze_1 (x, insn)
*** 3358,3364 ****
  
  	      for (u = reg_last_uses[regno + i]; u; u = XEXP (u, 1))
  		add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
- 	      reg_last_uses[regno + i] = 0;
  
  	      for (u = reg_last_sets[regno + i]; u; u = XEXP (u, 1))
  		add_dependence (insn, XEXP (u, 0), REG_DEP_OUTPUT);
--- 3358,3363 ----
*************** sched_analyze_1 (x, insn)
*** 3367,3372 ****
--- 3366,3372 ----
  		 but sets must be ordered with respect to a pending clobber. */
  	      if (code == SET)
  		{
+ 	          reg_last_uses[regno + i] = 0;
  	          for (u = reg_last_clobbers[regno + i]; u; u = XEXP (u, 1))
  		    add_dependence (insn, XEXP (u, 0), REG_DEP_OUTPUT);
  	          SET_REGNO_REG_SET (reg_pending_sets, regno + i);
*************** sched_analyze_1 (x, insn)
*** 3387,3399 ****
  
  	  for (u = reg_last_uses[regno]; u; u = XEXP (u, 1))
  	    add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
- 	  reg_last_uses[regno] = 0;
  
  	  for (u = reg_last_sets[regno]; u; u = XEXP (u, 1))
  	    add_dependence (insn, XEXP (u, 0), REG_DEP_OUTPUT);
  
  	  if (code == SET)
  	    {
  	      for (u = reg_last_clobbers[regno]; u; u = XEXP (u, 1))
  		add_dependence (insn, XEXP (u, 0), REG_DEP_OUTPUT);
  	      SET_REGNO_REG_SET (reg_pending_sets, regno);
--- 3387,3399 ----
  
  	  for (u = reg_last_uses[regno]; u; u = XEXP (u, 1))
  	    add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
  
  	  for (u = reg_last_sets[regno]; u; u = XEXP (u, 1))
  	    add_dependence (insn, XEXP (u, 0), REG_DEP_OUTPUT);
  
  	  if (code == SET)
  	    {
+ 	      reg_last_uses[regno] = 0;
  	      for (u = reg_last_clobbers[regno]; u; u = XEXP (u, 1))
  		add_dependence (insn, XEXP (u, 0), REG_DEP_OUTPUT);
  	      SET_REGNO_REG_SET (reg_pending_sets, regno);


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