diff options
author | Sergei Trofimovich <siarheit@google.com> | 2023-09-27 14:29:12 +0100 |
---|---|---|
committer | Sergei Trofimovich <siarheit@google.com> | 2023-10-05 17:14:27 +0100 |
commit | 043a6fcbc27f8721301eb2f72a7839f54f393003 (patch) | |
tree | 119de82d465a4b2b82f1d0dcab76b65efe4ed62d /gcc/tree-pass.h | |
parent | 604e76ed867ebde255ccfac835c6f8d6fb5fd4a9 (diff) | |
download | gcc-043a6fcbc27f8721301eb2f72a7839f54f393003.zip gcc-043a6fcbc27f8721301eb2f72a7839f54f393003.tar.gz gcc-043a6fcbc27f8721301eb2f72a7839f54f393003.tar.bz2 |
ipa-utils: avoid uninitialized probabilities on ICF [PR111559]
r14-3459-g0c78240fd7d519 "Check that passes do not forget to define profile"
exposed check failures in cases when gcc produces uninitialized profile
probabilities. In case of PR/111559 uninitialized profile is generated
by edges executed 0 times reported by IPA profile:
$ gcc -O2 -fprofile-generate pr111559.c -o b -fopt-info
$ ./b
$ gcc -O2 -fprofile-use -fprofile-correction pr111559.c -o b -fopt-info
pr111559.c: In function 'rule1':
pr111559.c:6:13: error: probability of edge 3->4 not initialized
6 | static void rule1(void) { if (p) edge(); }
| ^~~~~
during GIMPLE pass: fixup_cfg
pr111559.c:6:13: internal compiler error: verify_flow_info failed
The change conservatively ignores updates with zero execution counts and
uses initially assigned probabilities (`always` probability in case of
the example).
PR ipa/111283
PR gcov-profile/111559
gcc/
* ipa-utils.cc (ipa_merge_profiles): Avoid producing
uninitialized probabilities when merging counters with zero
denominators.
gcc/testsuite/
* gcc.dg/tree-prof/pr111559.c: New test.
Diffstat (limited to 'gcc/tree-pass.h')
0 files changed, 0 insertions, 0 deletions