The basic block frequencies used when compiling without profiling information
appear to be non-sensical. For instance, a case where block 0 is fed by the
entry block but has a frequency of 0. This causes EDGE_FREQUENCY to return
zero, which affects optimizations such as final.c:compute_alignments().
An example is deflate.c from gzip-1.2.4a. Compiled with GCC mainline on
powerpc-linux with options
-m32 -O3 -mcpu=power4 -ffast-math -funroll-loops -fpeel-loops
-ftree-loop-linear
deflate.c.50.compgotos shows the following information for function deflate:
Reordered sequence:
0 bb 0 [0]
1 bb 1 [0]
2 bb 2 [1]
3 bb 3 [1]
4 bb 4 [0]
5 bb 5 [0]
6 bb 6 [0]
7 bb 7 [0]
8 bb 8 [0]
9 bb 9 [0]
10 bb 10 [0]
11 bb 11 [0]
12 bb 12 [0]
13 bb 13 [0]
14 bb 14 [0]
15 bb 15 [0]
16 bb 16 [0]
17 bb 17 [0]
18 bb 18 [1]
19 bb 19 [0]
20 bb 20 [0]
21 bb 21 [0]
22 bb 22 [5]
23 bb 23 [5]
24 bb 24 [5]
25 bb 25 [3]
26 bb 26 [4]
27 bb 27 [4]
28 bb 28 [2]
29 bb 29 [1]
30 bb 30 [1250]
31 bb 31 [625]
32 bb 32 [1250]
33 bb 33 [625]
34 bb 34 [1250]
35 bb 35 [625]
36 bb 36 [1250]
37 bb 37 [625]
38 bb 38 [1250]
39 bb 39 [625]
40 bb 40 [1250]
...
Basic blocks 10-11 contain a critical loop, but the basic block frequencies
misrepresent it as a very cold block.
--
Summary: Basic block frequencies inaccurate
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P2
Component: gcov/profile
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dje at gcc dot gnu dot org
GCC target triplet: powerpc-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24487