invoke.texi (-Wcoverage-mismatch): Document.
2007-01-25 Richard Guenther <rguenther@suse.de> * doc/invoke.texi (-Wcoverage-mismatch): Document. * common.opt (-Wcoverage-mismatch): New warning option. * coverage.c (get_coverage_counts): Ignore coverage mismatch if -Wcoverage-mismatch is given. * gcc.dg/tree-prof/tree-prof.exp: Define _PROFILE_GENERATE and _PROFILE_USE. * gcc.dg/tree-prof/wcoverage-mismatch.c: New testcase. From-SVN: r121169
This commit is contained in:
parent
04a9178839
commit
16c1c158d8
|
@ -1,3 +1,10 @@
|
||||||
|
2007-01-25 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
|
* doc/invoke.texi (-Wcoverage-mismatch): Document.
|
||||||
|
* common.opt (-Wcoverage-mismatch): New warning option.
|
||||||
|
* coverage.c (get_coverage_counts): Ignore coverage mismatch
|
||||||
|
if -Wcoverage-mismatch is given.
|
||||||
|
|
||||||
2007-01-25 Razya Ladelsky <razya@il.ibm.com>
|
2007-01-25 Razya Ladelsky <razya@il.ibm.com>
|
||||||
|
|
||||||
* ipa-cp.c (ipcp_insert_stage, ipcp_driver): Support for SSA.
|
* ipa-cp.c (ipcp_insert_stage, ipcp_driver): Support for SSA.
|
||||||
|
|
|
@ -197,6 +197,10 @@ Wvolatile-register-var
|
||||||
Common Var(warn_register_var)
|
Common Var(warn_register_var)
|
||||||
Warn when a register variable is declared volatile
|
Warn when a register variable is declared volatile
|
||||||
|
|
||||||
|
Wcoverage-mismatch
|
||||||
|
Common RejectNegative Var(warn_coverage_mismatch)
|
||||||
|
Warn instead of error in case profiles in -fprofile-use do not match
|
||||||
|
|
||||||
aux-info
|
aux-info
|
||||||
Common Separate
|
Common Separate
|
||||||
-aux-info <file> Emit declaration information into <file>
|
-aux-info <file> Emit declaration information into <file>
|
||||||
|
|
|
@ -347,25 +347,46 @@ get_coverage_counts (unsigned counter, unsigned expected,
|
||||||
{
|
{
|
||||||
warning (0, "no coverage for function %qs found", IDENTIFIER_POINTER
|
warning (0, "no coverage for function %qs found", IDENTIFIER_POINTER
|
||||||
(DECL_ASSEMBLER_NAME (current_function_decl)));
|
(DECL_ASSEMBLER_NAME (current_function_decl)));
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
checksum = compute_checksum ();
|
checksum = compute_checksum ();
|
||||||
|
if (entry->checksum != checksum
|
||||||
|
|| entry->summary.num != expected)
|
||||||
|
{
|
||||||
|
static int warned = 0;
|
||||||
|
const char *id = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME
|
||||||
|
(current_function_decl));
|
||||||
|
|
||||||
|
if (warn_coverage_mismatch)
|
||||||
|
warning (OPT_Wcoverage_mismatch, "coverage mismatch for function "
|
||||||
|
"%qs while reading counter %qs", id, ctr_names[counter]);
|
||||||
|
else
|
||||||
|
error ("coverage mismatch for function %qs while reading counter %qs",
|
||||||
|
id, ctr_names[counter]);
|
||||||
|
|
||||||
|
if (!inhibit_warnings)
|
||||||
|
{
|
||||||
if (entry->checksum != checksum)
|
if (entry->checksum != checksum)
|
||||||
{
|
inform ("checksum is %x instead of %x", entry->checksum, checksum);
|
||||||
error ("coverage mismatch for function %qs while reading counter %qs",
|
else
|
||||||
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)),
|
inform ("number of counters is %d instead of %d",
|
||||||
ctr_names[counter]);
|
entry->summary.num, expected);
|
||||||
error ("checksum is %x instead of %x", entry->checksum, checksum);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
else if (entry->summary.num != expected)
|
|
||||||
|
if (warn_coverage_mismatch
|
||||||
|
&& !inhibit_warnings
|
||||||
|
&& !warned++)
|
||||||
{
|
{
|
||||||
error ("coverage mismatch for function %qs while reading counter %qs",
|
inform ("coverage mismatch ignored due to -Wcoverage-mismatch");
|
||||||
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl)),
|
inform (flag_guess_branch_prob
|
||||||
ctr_names[counter]);
|
? "execution counts estimated"
|
||||||
error ("number of counters is %d instead of %d", entry->summary.num, expected);
|
: "execution counts assumed to be zero");
|
||||||
return 0;
|
if (!flag_guess_branch_prob)
|
||||||
|
inform ("this can result in poorly optimized code");
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (summary)
|
if (summary)
|
||||||
|
|
|
@ -225,7 +225,7 @@ Objective-C and Objective-C++ Dialects}.
|
||||||
-w -Wextra -Wall -Waggregate-return -Walways-true -Warray-bounds @gol
|
-w -Wextra -Wall -Waggregate-return -Walways-true -Warray-bounds @gol
|
||||||
-Wno-attributes -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol
|
-Wno-attributes -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol
|
||||||
-Wchar-subscripts -Wclobbered -Wcomment @gol
|
-Wchar-subscripts -Wclobbered -Wcomment @gol
|
||||||
-Wconversion -Wno-deprecated-declarations @gol
|
-Wconversion -Wcoverage-mismatch -Wno-deprecated-declarations @gol
|
||||||
-Wdisabled-optimization -Wno-div-by-zero @gol
|
-Wdisabled-optimization -Wno-div-by-zero @gol
|
||||||
-Wempty-body -Wno-endif-labels @gol
|
-Wempty-body -Wno-endif-labels @gol
|
||||||
-Werror -Werror-* -Werror-implicit-function-declaration @gol
|
-Werror -Werror-* -Werror-implicit-function-declaration @gol
|
||||||
|
@ -2282,6 +2282,20 @@ diagnostic emitted, which indicates which command line option directly
|
||||||
controls that diagnostic, when such an option is known to the
|
controls that diagnostic, when such an option is known to the
|
||||||
diagnostic machinery.
|
diagnostic machinery.
|
||||||
|
|
||||||
|
@item -Wcoverage-mismatch
|
||||||
|
@opindex Wcoverage-mismatch
|
||||||
|
Warn if feedback profiles do not match when using the
|
||||||
|
@option{-fprofile-use} option.
|
||||||
|
If a source file was changed between @option{-fprofile-gen} and
|
||||||
|
@option{-fprofile-use}, the files with the profile feedback can fail
|
||||||
|
to match the source file and GCC can not use the profile feedback
|
||||||
|
information. By default, GCC emits an error message in this case.
|
||||||
|
The option @option{-Wcoverage-mismatch} emits a warning instead of an
|
||||||
|
error. GCC does not use appropriate feedback profiles, so using this
|
||||||
|
option can result in poorly optimized code. This option is useful
|
||||||
|
only in the case of very minor changes such as bugfixes to an
|
||||||
|
existing code-base.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Warning Options
|
@node Warning Options
|
||||||
|
@ -5613,6 +5627,10 @@ generally profitable only with profile feedback available.
|
||||||
The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
|
The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
|
||||||
@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
|
@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
|
||||||
|
|
||||||
|
By default, GCC emits an error message if the feedback profiles do not
|
||||||
|
match the source code. This error can be turned into a warning by using
|
||||||
|
@option{-Wcoverage-mismatch}. Note this may result in poorly optimized
|
||||||
|
code.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
The following options control compiler behavior regarding floating
|
The following options control compiler behavior regarding floating
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
2007-01-25 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
|
* gcc.dg/tree-prof/tree-prof.exp: Define _PROFILE_GENERATE
|
||||||
|
and _PROFILE_USE.
|
||||||
|
* gcc.dg/tree-prof/wcoverage-mismatch.c: New testcase.
|
||||||
|
|
||||||
2007-01-25 Razya Ladelsky <razya@il.ibm.com>
|
2007-01-25 Razya Ladelsky <razya@il.ibm.com>
|
||||||
|
|
||||||
* gcc.dg/ipa/ipa-1.c: Update scan tree dump.
|
* gcc.dg/ipa/ipa-1.c: Update scan tree dump.
|
||||||
|
|
|
@ -41,8 +41,8 @@ load_lib profopt.exp
|
||||||
# These are globals used by profopt-execute. The first is options
|
# These are globals used by profopt-execute. The first is options
|
||||||
# needed to generate profile data, the second is options to use the
|
# needed to generate profile data, the second is options to use the
|
||||||
# profile data.
|
# profile data.
|
||||||
set profile_option "-fprofile-generate"
|
set profile_option "-fprofile-generate -D_PROFILE_GENERATE"
|
||||||
set feedback_option "-fprofile-use"
|
set feedback_option "-fprofile-use -D_PROFILE_USE"
|
||||||
|
|
||||||
foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
|
foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
|
||||||
# If we're only testing specific files and this isn't one of them, skip it.
|
# If we're only testing specific files and this isn't one of them, skip it.
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/* { dg-options "-O2 -Wcoverage-mismatch -w" } */
|
||||||
|
|
||||||
|
int __attribute__((noinline)) bar (void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int foo (int i)
|
||||||
|
{
|
||||||
|
#ifdef _PROFILE_USE
|
||||||
|
if (i)
|
||||||
|
bar ();
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
foo (argc);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue