This is the mail archive of the gcc-bugs@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]

[Bug optimization/9240] weird scheduling on v850 unless -fno-sched-spec specified


------- Additional Comments From vmakarov at redhat dot com  2004-01-15 17:22 -------
Some analysis:

1. Scheduler uses own algorithm of probablity calculation (3 basic
   blocks of the test have probability 100/50/100%).

2. It should use common infrastructure bb frequency and edge
   probablility.

3. Even if it used the common infrastructure, bb frequnecies would be
   still wrong (10000, 9001, 10000 or 100/90/100%).  So builtin-expect
   is ignored in the infrastructure too.  I saw broken builtin-expect
   many times during my 6 years work on gcc.

4. Becuase the probability of the 2nd bb is 50%, it includes 2
   insns from it to schedule into the 1st bb.

So fixing the problem could be:

  1. Taking builtin_expect into account in scheduler algorithm of
     probablity calculation.

  2. Start using the common infrastructure bb frequency and edge
     probablility and fixing there builtin_expect.

  Neither the 1st solution nor the 2nd one is easy. And they include
the risk of new bugs.  So I think it is not reasonable to fix it for
3.4.  It is a just generation of non-optimal code (scheduler works by
heuristics.  there will be always some unoptimal schedules.  we are
just oriented to guarantee that scheduler improves code in overall on
credible benchmarks like Spec).  The problem was pressent in 3.3.

  I'll try to fix the problem in 3-4 months.

Vlad


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vmakarov at redhat dot com


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


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