I said if you compile val-prof-1.c the same way bprob-1.c is compiled
you get an warning.
gcc -g -fprofile-arcs val-prof-1.c -o val-prof-1.x1
Lijuan Hai wrote:
seen in gcc-4.2, gcc.misc-tests/bprob-1.c is compiled with
-fprofile-arcs and -fbranch-probabilities.
gcc.dg/tree-prof/val-prof-1.c is compiled with -fprofile-generate and
-fprofile-use. so there won't be any warnings.
2008/4/25 Edmar Wienskoski-RA8797 <[EMAIL PROTECTED]>:
The test case gcc.misc/bprob-1.c is compiled with fprofile-arcs /
fprofile-use.
The option fprofile-arcs does not enable value profiling.
At the second stage compilation, the option fprofile-use enables value
profiling. Within tree_find_values_to_profile, if one of the value
optimizations algorithms sees an optimization opportunity, it will push an
histogram on stack. Later, compute_value_histograms will call
get_coverage_counts to load this histogram, but none where generated.
A warning is issued which means a FAIL under dejagnu.
I found this problem with bprob-1.c while debugging a new value profile
optimization. But it can be reproduced in any target, with non-modified gcc,
at any optimization level, using one of the value profile test cases and
compiler options fprofile-arcs / fprofile-use (same used with bprob-1.c).
Here is an example using gcc.dg/tree-prof/val-prof-1.c:
./gcc-trunk-reference/install_e600/bin/gcc -g -fprofile-arcs val-prof-1.c
-o val-prof-1.x1
./val-prof-1.x1
./gcc-trunk-reference/install_e600/bin/gcc -g -fprofile-use val-prof-1.c -o
val-prof-1.x2
val-prof-1.c: In function 'main':
val-prof-1.c:17: warning: no coverage for function 'main' found
IMHO there are 3 ways to go with this:
1 - Require user behavior change (create new option -fprofile-arcs-use to
match -fprofile-arcs, mismatch of options is bad user behavior)
2 - Record on the .gcda file how the first stage were done (fprofile-arcs /
fprofile-generate, etc) and use it to disable other optimizations under
fprofile-use (Does this already exists ?, I am not familiar with the .gcda
layout)
3 - Let get_coverage_counts ignore inconsistencies when loading data.
Helps / comments are appreciated.
Edmar