[patch] Remove loop notes (6/8) -- scheduler

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Tue Mar 14 11:46:00 GMT 2006


Hello,

this patch removes references to loop notes from scheduler.  According
to http://gcc.gnu.org/ml/gcc-patches/2006-03/msg00485.html, we do not
need to care about loops in scheduler any more, so this patch should be
harmless.  Just for sure, I ran specs on x86_64 -- the results are
neutral (slight decrease in specint, increase in specfp, both probably
just a noise).

Bootstrapped & regtested on i686.

Zdenek

	* haifa-sched.c (unlink_other_notes, reemit_notes): Do not handle
	loop notes.
	* sched-deps.c (sched_analyze_insn, sched_analyze): Ditto.

Index: haifa-sched.c
===================================================================
*** haifa-sched.c	(revision 111675)
--- haifa-sched.c	(working copy)
*************** unlink_other_notes (rtx insn, rtx tail)
*** 989,997 ****
  	PREV_INSN (next) = prev;
  
        /* See sched_analyze to see how these are handled.  */
!       if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_BEG
! 	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_END
! 	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK
  	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_BEG
  	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_END)
  	{
--- 989,995 ----
  	PREV_INSN (next) = prev;
  
        /* See sched_analyze to see how these are handled.  */
!       if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK
  	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_BEG
  	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_END)
  	{
*************** move_insn1 (rtx insn, rtx last)
*** 1615,1621 ****
  }
  
  /* Search INSN for REG_SAVE_NOTE note pairs for
!    NOTE_INSN_{LOOP,EHREGION}_{BEG,END}; and convert them back into
     NOTEs.  The REG_SAVE_NOTE note following first one is contains the
     saved value for NOTE_BLOCK_NUMBER which is useful for
     NOTE_INSN_EH_REGION_{BEG,END} NOTEs.  LAST is the last instruction
--- 1613,1619 ----
  }
  
  /* Search INSN for REG_SAVE_NOTE note pairs for
!    NOTE_INSN_EHREGION_{BEG,END}; and convert them back into
     NOTEs.  The REG_SAVE_NOTE note following first one is contains the
     saved value for NOTE_BLOCK_NUMBER which is useful for
     NOTE_INSN_EH_REGION_{BEG,END} NOTEs.  LAST is the last instruction

Index: sched-deps.c
===================================================================
*** sched-deps.c	(revision 111675)
--- sched-deps.c	(working copy)
*************** static void fixup_sched_groups (rtx);
*** 96,102 ****
  static void flush_pending_lists (struct deps *, rtx, int, int);
  static void sched_analyze_1 (struct deps *, rtx, rtx);
  static void sched_analyze_2 (struct deps *, rtx, rtx);
! static void sched_analyze_insn (struct deps *, rtx, rtx, rtx);
  
  static rtx sched_get_condition (rtx);
  static int conditions_mutex_p (rtx, rtx);
--- 96,102 ----
  static void flush_pending_lists (struct deps *, rtx, int, int);
  static void sched_analyze_1 (struct deps *, rtx, rtx);
  static void sched_analyze_2 (struct deps *, rtx, rtx);
! static void sched_analyze_insn (struct deps *, rtx, rtx);
  
  static rtx sched_get_condition (rtx);
  static int conditions_mutex_p (rtx, rtx);
*************** sched_analyze_2 (struct deps *deps, rtx 
*** 881,887 ****
  /* Analyze an INSN with pattern X to find all dependencies.  */
  
  static void
! sched_analyze_insn (struct deps *deps, rtx x, rtx insn, rtx loop_notes)
  {
    RTX_CODE code = GET_CODE (x);
    rtx link;
--- 881,887 ----
  /* Analyze an INSN with pattern X to find all dependencies.  */
  
  static void
! sched_analyze_insn (struct deps *deps, rtx x, rtx insn)
  {
    RTX_CODE code = GET_CODE (x);
    rtx link;
*************** sched_analyze_insn (struct deps *deps, r
*** 1002,1029 ****
  	}
      }
  
-   /* If there is a {LOOP,EHREGION}_{BEG,END} note in the middle of a basic
-      block, then we must be sure that no instructions are scheduled across it.
-      Otherwise, the reg_n_refs info (which depends on loop_depth) would
-      become incorrect.  */
-   if (loop_notes)
-     {
-       rtx link;
- 
-       /* Update loop_notes with any notes from this insn.  */
-       link = loop_notes;
-       while (XEXP (link, 1))
- 	{
- 	  gcc_assert (INTVAL (XEXP (link, 0)) == NOTE_INSN_LOOP_BEG
- 		      || INTVAL (XEXP (link, 0)) == NOTE_INSN_LOOP_END);
- 
- 	  reg_pending_barrier = MOVE_BARRIER;
- 	  link = XEXP (link, 1);
- 	}
-       XEXP (link, 1) = REG_NOTES (insn);
-       REG_NOTES (insn) = loop_notes;
-     }
- 
    /* If this instruction can throw an exception, then moving it changes
       where block boundaries fall.  This is mighty confusing elsewhere.
       Therefore, prevent such an instruction from being moved.  */
--- 1002,1007 ----
*************** void
*** 1245,1251 ****
  sched_analyze (struct deps *deps, rtx head, rtx tail)
  {
    rtx insn;
-   rtx loop_notes = 0;
  
    if (current_sched_info->use_cselib)
      cselib_init (true);
--- 1223,1228 ----
*************** sched_analyze (struct deps *deps, rtx he
*** 1279,1286 ****
  		deps->last_pending_memory_flush
  		  = alloc_INSN_LIST (insn, deps->last_pending_memory_flush);
  	    }
! 	  sched_analyze_insn (deps, PATTERN (insn), insn, loop_notes);
! 	  loop_notes = 0;
  	}
        else if (CALL_P (insn))
  	{
--- 1256,1262 ----
  		deps->last_pending_memory_flush
  		  = alloc_INSN_LIST (insn, deps->last_pending_memory_flush);
  	    }
! 	  sched_analyze_insn (deps, PATTERN (insn), insn);
  	}
        else if (CALL_P (insn))
  	{
*************** sched_analyze (struct deps *deps, rtx he
*** 1334,1341 ****
  	  add_dependence_list_and_free (insn, &deps->sched_before_next_call, 1,
  					REG_DEP_ANTI);
  
! 	  sched_analyze_insn (deps, PATTERN (insn), insn, loop_notes);
! 	  loop_notes = 0;
  
  	  /* In the absence of interprocedural alias analysis, we must flush
  	     all pending reads and writes, and start new dependencies starting
--- 1310,1316 ----
  	  add_dependence_list_and_free (insn, &deps->sched_before_next_call, 1,
  					REG_DEP_ANTI);
  
! 	  sched_analyze_insn (deps, PATTERN (insn), insn);
  
  	  /* In the absence of interprocedural alias analysis, we must flush
  	     all pending reads and writes, and start new dependencies starting
*************** sched_analyze (struct deps *deps, rtx he
*** 1358,1376 ****
        if (NOTE_P (insn))
  	gcc_assert (NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_BEG
  		    && NOTE_LINE_NUMBER (insn) != NOTE_INSN_EH_REGION_END);
- 
-       /* See comments on reemit_notes as to why we do this.
- 	 ??? Actually, the reemit_notes just say what is done, not why.  */
- 
-       if (NOTE_P (insn)
- 	  && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
- 	      || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END))
- 	{
- 	  loop_notes = alloc_EXPR_LIST (REG_SAVE_NOTE,
- 					GEN_INT (NOTE_LINE_NUMBER (insn)),
- 					loop_notes);
- 	  CONST_OR_PURE_CALL_P (loop_notes) = CONST_OR_PURE_CALL_P (insn);
- 	}
  
        if (current_sched_info->use_cselib)
  	cselib_process_insn (insn);
--- 1333,1338 ----



More information about the Gcc-patches mailing list