From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7840) id 518C63857833; Tue, 25 Oct 2022 21:04:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 518C63857833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666731848; bh=nW0sxNoyehndnNfeT3bjV86OdqkfG2hfUN/02tV2ZUs=; h=From:To:Subject:Date:From; b=MtPz2YS4ufgy3fKYfVplNHZs/dSJTP/eB+9A+f75dZXt8u8vAkaKfTgWKUOCIOJKW KbXe10VS+oRC3Bdc6L5ZJmkTAnnWcmNbgGA9FzPRk8BEapi4vCTG79g6vJvOdbtJDm XwckJH0Ok60+/dIAgQ7nE1HimPGvKINjyptpr7Qc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Eugene Rozenfeld To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3495] Start using discriminators in AutoFDO. X-Act-Checkin: gcc X-Git-Author: Eugene Rozenfeld X-Git-Refname: refs/heads/master X-Git-Oldrev: 43e654afeba484d75fbee080262a038c1da00ad5 X-Git-Newrev: 65f5fa23844b55e3c6359e1612e6fdd4d10950d0 Message-Id: <20221025210408.518C63857833@sourceware.org> Date: Tue, 25 Oct 2022 21:04:08 +0000 (GMT) List-Id: https://gcc.gnu.org/g:65f5fa23844b55e3c6359e1612e6fdd4d10950d0 commit r13-3495-g65f5fa23844b55e3c6359e1612e6fdd4d10950d0 Author: Eugene Rozenfeld Date: Mon Apr 25 11:45:43 2022 -0700 Start using discriminators in AutoFDO. 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. Diff: --- 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;