public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9896] gcov-profile: Allow negative counts of indirect calls [PR105282]
@ 2022-04-21 9:27 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2022-04-21 9:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7b879564ec2bda6b5441fbaf231d70ec6359db01
commit r11-9896-g7b879564ec2bda6b5441fbaf231d70ec6359db01
Author: Sergei Trofimovich <siarheit@google.com>
Date: Fri Apr 15 08:35:27 2022 +0100
gcov-profile: Allow negative counts of indirect calls [PR105282]
TOPN metrics are histograms that contain overall count and per-bucket
count. Overall count can be negative when two profiles merge and some
of per-bucket metrics are disacarded.
Noticed as an ICE on python PGO build where gcc crashes as:
during IPA pass: modref
a.c:36:1: ICE: in stream_out_histogram_value, at value-prof.cc:340
36 | }
| ^
stream_out_histogram_value(output_block*, histogram_value_t*)
gcc/value-prof.c:340
gcc/ChangeLog:
PR gcov-profile/105282
* value-prof.c (stream_out_histogram_value): Allow negative counts
on HIST_TYPE_INDIR_CALL.
(cherry picked from commit 90a29845bfe7d6002e6c2fd49a97820b00fbc4a3)
Diff:
---
gcc/value-prof.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 42748771192..688089b04d2 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -336,6 +336,10 @@ stream_out_histogram_value (struct output_block *ob, histogram_value hist)
/* Note that the IOR counter tracks pointer values and these can have
sign bit set. */
;
+ else if (hist->type == HIST_TYPE_INDIR_CALL && i == 0)
+ /* 'all' counter overflow is stored as a negative value. Individual
+ counters and values are expected to be non-negative. */
+ ;
else
gcc_assert (value >= 0);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-21 9:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 9:27 [gcc r11-9896] gcov-profile: Allow negative counts of indirect calls [PR105282] Martin Liska
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).