http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54472



Andrey Belevantsev <abel at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

             Status|UNCONFIRMED                 |ASSIGNED

   Last reconfirmed|                            |2012-10-04

         AssignedTo|unassigned at gcc dot       |abel at gcc dot gnu.org

                   |gnu.org                     |

     Ever Confirmed|0                           |1



--- Comment #5 from Andrey Belevantsev <abel at gcc dot gnu.org> 2012-10-04 
12:43:36 UTC ---

(In reply to comment #4)

> (In reply to comment #3)

> > > For some reason, -fselective-scheduling is moving

> > > 

> > > (insn 19 16 22 2 (use (reg/i:SI 0 ax)) testcase.c:6 -1

> > >      (nil))

> > > 

> > > around. This insn marks function return, so IMO should be at the function 
> > > exit

> > > all the time. -fschedule-insns (without -fselective-scheduling) leaves 
> > > the insn

> > > at the function exit. Is it OK to move this marker around?

> > 

> > I will take a look but I'm out of office until Friday at least (maybe 
> > Monday).

> 

> Any progress on this?



Sorry Uros, I forgot about this.  I took a look, the reason is actually in

selective scheduler not handling implicit_sets (we miss dependencies between

implicit_sets register sets and other sets/clobbers).  In this example, we miss

a dependency between insns 9 and 16 and thus schedule insn #16 earlier than

insn #9 and then its dependent insn #19 earlier than insn #9.  Thus we are

moving the return mark before the actual function code.



The below patch fixes the test case for me.  I need to double-check whether I

have caught all cases of implicit_sets generating dependencies in sched-deps.c

and then I will submit the patch for review.



diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c

index e7ca3f1..0fbfdbe 100644

--- a/gcc/sel-sched-ir.c

+++ b/gcc/sel-sched-ir.c

@@ -3185,7 +3185,7 @@ has_dependence_note_reg_set (int regno)

          || reg_last->clobbers != NULL)

        *dsp = (*dsp & ~SPECULATIVE) | DEP_OUTPUT;



-      if (reg_last->uses)

+      if (reg_last->uses || reg_last->implicit_sets)

        *dsp = (*dsp & ~SPECULATIVE) | DEP_ANTI;

     }

 }

@@ -3205,7 +3205,7 @@ has_dependence_note_reg_clobber (int regno)

       if (reg_last->sets)

        *dsp = (*dsp & ~SPECULATIVE) | DEP_OUTPUT;



-      if (reg_last->uses)

+      if (reg_last->uses || reg_last->implicit_sets)

        *dsp = (*dsp & ~SPECULATIVE) | DEP_ANTI;

     }

 }

Reply via email to