From: Martin Liska Date: Mon, 30 Jan 2017 15:35:57 +0000 (+0100) Subject: Fix profile corruption with -O1 (PR gcov-profile/79259) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=37731134c71cc81ed8245d583e1fbbfab879fa5f;p=gcc.git Fix profile corruption with -O1 (PR gcov-profile/79259) 2017-01-30 Martin Liska PR gcov-profile/79259 * opts.c (common_handle_option): Enable flag_ipa_bit_cp w/ -fprofile-generate. 2017-01-30 Martin Liska PR gcov-profile/79259 * g++.dg/tree-prof/pr79259.C: New test. From-SVN: r245031 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 620c4b09eba..206b8a59c41 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-01-30 Martin Liska + + PR gcov-profile/79259 + * opts.c (common_handle_option): Enable flag_ipa_bit_cp w/ + -fprofile-generate. + 2017-01-30 Martin Liska PR bootstrap/78985 diff --git a/gcc/opts.c b/gcc/opts.c index 5f573a16ff1..b38e9b4f3a7 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2150,6 +2150,8 @@ common_handle_option (struct gcc_options *opts, opts->x_flag_profile_values = value; if (!opts_set->x_flag_inline_functions) opts->x_flag_inline_functions = value; + if (!opts_set->x_flag_ipa_bit_cp) + opts->x_flag_ipa_bit_cp = value; /* FIXME: Instrumentation we insert makes ipa-reference bitmaps quadratic. Disable the pass until better memory representation is done. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 33f02489e4e..cbab69fd1b1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-30 Martin Liska + + PR gcov-profile/79259 + * g++.dg/tree-prof/pr79259.C: New test. + 2017-01-30 Richard Biener PR tree-optimization/79276 diff --git a/gcc/testsuite/g++.dg/tree-prof/pr79259.C b/gcc/testsuite/g++.dg/tree-prof/pr79259.C new file mode 100644 index 00000000000..a55172b62d2 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-prof/pr79259.C @@ -0,0 +1,20 @@ +/* { dg-options "-O1" } */ + +inline bool +a (int b) +{ + return (b & 5) != b; +} +int c; +int +fn2 () +{ + if (a (c == 0)) + return 0; +} + +int main() +{ + fn2(); +} +