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]

Re: RFA: patch cheking dangerous insns in sched-ebb.c


On Fri, Feb 21, 2003 at 10:57:59AM -0500, Vladimir N. Makarov wrote:
> It can't.  I add dependence not for all insns but for insns which can
> cause an exception (they are TRAP_RISKY, IRISKY, PRISKY_CANDIDATE and
> some PFREE_CANDIDATEs).  TRAP_FREE, IFREE and some PFREE_CANDIDATEs can
> be moved through the jump, in order words speculatively (of course if
> they do not kill values on split edges in haifa scheduler sense.  That
> was implemented in sched-ebb).

That is not the search loop I'm concerned about.  Lets 
look at the code again:

+   for (insn = head; insn != NEXT_INSN (tail); insn = NEXT_INSN (insn))
+     if (GET_CODE (insn) == JUMP_INSN)
+       last_jump = insn;
+     else if (INSN_P (insn) && last_jump != NULL_RTX)
+       {
+       class = haifa_classify_insn (insn);
+       if (class == TRAP_RISKY || class == IRISKY
+           || class == PRISKY_CANDIDATE || class == PFREE_CANDIDATE)

This loop iterates forward over the insns in the block, adding
dependencies for those that are risky.  This is indeed necessary.

+         for (prev = last_jump;
+              prev != PREV_INSN (head);
+              prev = PREV_INSN (prev))
+           /* ??? We could implement better checking PRISKY_CANDIATEs
+              analogous to sched-rgn.c.  */
+           if (GET_CODE (prev) == JUMP_INSN

This loop iterates backward over previous insns in the superblock.
You only add dependencies for jump insns, but you still search the
entire superblock.

I claim that this search is not necessary.

(1) Adding a dependency on the last jump insn prevents the
    trapping insn from being moved beyond it.  
(2) A jump insn depends on the previous jump insn.  Thus by
    transitivity, we do not need to search backward to 
    prevent a previous jump insn from somehow being 
    scheduled after the trapping insn.



r~


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