* [PATCH][PUSHED] Start using discriminators in AutoFDO
@ 2022-10-25 21:06 Eugene Rozenfeld
0 siblings, 0 replies; only message in thread
From: Eugene Rozenfeld @ 2022-10-25 21:06 UTC (permalink / raw)
To: gcc-patches
Tested on x86_64-pc-linux-gnu.
gcc/ChangeLog:
* auto-profile.cc (get_combined_location): Include discriminator in the
returned combined location.
(read_function_instance): Read discriminators from profiles.
---
gcc/auto-profile.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index ca48404eaf1..97307321cbf 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -363,7 +363,8 @@ get_combined_location (location_t loc, tree decl)
/* TODO: allow more bits for line and less bits for discriminator. */
if (LOCATION_LINE (loc) - DECL_SOURCE_LINE (decl) >= (1<<16))
warning_at (loc, OPT_Woverflow, "offset exceeds 16 bytes");
- return ((LOCATION_LINE (loc) - DECL_SOURCE_LINE (decl)) << 16);
+ return ((LOCATION_LINE (loc) - DECL_SOURCE_LINE (decl)) << 16)
+ | get_discriminator_from_loc (loc);
}
/* Return the function decl of a given lexical BLOCK. */
@@ -652,7 +653,7 @@ function_instance::read_function_instance (function_instance_stack *stack,
for (unsigned i = 0; i < num_pos_counts; i++)
{
- unsigned offset = gcov_read_unsigned () & 0xffff0000;
+ unsigned offset = gcov_read_unsigned ();
unsigned num_targets = gcov_read_unsigned ();
gcov_type count = gcov_read_counter ();
s->pos_counts[offset].count = count;
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-25 21:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 21:06 [PATCH][PUSHED] Start using discriminators in AutoFDO Eugene Rozenfeld
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).