From patchwork Wed Oct 9 23:57:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 282095 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E13C22C011C for ; Thu, 10 Oct 2013 10:57:50 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=fk1pOvGDaHHAc3AG2BT/Zk1FWiu9oyIAUs7lqjgLU3GPMv 40kB5K9SfTpR7wrvegIkuwEjs1npfbXsNzwSpuNSLBCuI5pB5HvfFW8Ce1hV4pJF lJ6BFbWjXmc2udFLl+8/mnE0CmyhkLi1oZ6BwZpqCzAcD4SfCVvovkBncQpSc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=LEyjHp4b67HvsBbAZdtHPYMfIXE=; b=BdIOvBz5U+6sVuoc4PtK yE8MEanMRvAeK1JBerHh4cjw4ODO50FP/k14UfNjJiY6/zDShz7ki0dyoAL1Jdu9 9+fLGsGq9cV7z/aQA8lz9s8WugoCDJ8dntUvMQ2/l8llFN0uvkVMUF0RpwmeRDTQ IdiF1QvZLvUPAkPBFn34Snk= Received: (qmail 9761 invoked by alias); 9 Oct 2013 23:57:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 9749 invoked by uid 89); 9 Oct 2013 23:57:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f178.google.com Received: from mail-ie0-f178.google.com (HELO mail-ie0-f178.google.com) (209.85.223.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 09 Oct 2013 23:57:44 +0000 Received: by mail-ie0-f178.google.com with SMTP id to1so3626794ieb.9 for ; Wed, 09 Oct 2013 16:57:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=K+rXUQcRn73RUniHtPW1PqeCMe+dMK3s7o5sSKNoumw=; b=fX9yR0PH5/YCOwSh8stdeJhMFrXUHTWsLCRwu6i5pzm7QhjsxIaTCkPEI+v5Fup6J4 yZhZcY3d0NZAZUOwav8KaTzI8VzvslBv9NV3zS4XhMX6z6BKRumpIshLC5yDQdyrxvC8 UZWktn1LzQFJd1VRlFrEHukXz8BLOv8Mis2NkHbF7y4P5zYB+h19KGnc318U5krX1rxV 79Lm02u78ZWOk1tFhEAnE5oYpKUjgduvQI6Rn+ZDRVPcSM7fE4buDnizv+6tmDyYl/cg 8+Gcv3o8Y3z7/ZSUnrmSPMSXhCOkPiQxG9NeGrKlZab5aiiuWeO7d2T9vRKI8rb+g07b TiyA== X-Gm-Message-State: ALoCoQkVsJx35WT7wFy87kQO8SnQWlkFy/P+BAqVhfKh0Fe4L5nm5xT8XUtPWmO3mZNrUOaunBAwqsovkdx6mcDMsmrDcdpueX763DrLqGNcXcFzQZErlc1lrUPHSLQiwWCse4oxXf7FKUk8eoGCXCIWI4BuLytYeZly7689g6J03hP1wa/m3X/AMqVnVGtECyEU/g+9d5D23vboqKGAClhcbrthpXN8ng== MIME-Version: 1.0 X-Received: by 10.42.27.82 with SMTP id i18mr6251613icc.29.1381363062418; Wed, 09 Oct 2013 16:57:42 -0700 (PDT) Received: by 10.64.9.133 with HTTP; Wed, 9 Oct 2013 16:57:42 -0700 (PDT) Date: Wed, 9 Oct 2013 16:57:42 -0700 Message-ID: Subject: [GOOGLE] Represent the callsite with lineno only for AutoFDO From: Dehao Chen To: GCC Patches , David Li X-IsSubscribed: yes In legacy AutoFDO, callsite is represented as a (lineno, callee_name) pair because there could be multiple calls in one line. However, as we enhanced the debug info by assigning discriminators for each function call in the same line, callee_name is not needed when indexing the callsite. This patch will improve AutoFDO performance because some functions have alias (e.g. constructors/destructors), which could make the function name matching fail. Bootstrapped and passed regression test. OK for google-4_8 branch. Dehao Index: gcc/auto-profile.c =================================================================== --- gcc/auto-profile.c (revision 203331) +++ gcc/auto-profile.c (working copy) @@ -174,10 +174,8 @@ class function_instance { const function_instance *get_function_instance_by_decl (unsigned lineno, tree decl) const; - /* Callsite, represented as (decl_lineno, callee_function_name_index). */ - typedef std::pair callsite; - /* Map from callsite to callee function_instance. */ - typedef std::map callsite_map; + /* Map from callsite decl_lineno to callee function_instance. */ + typedef std::map callsite_map; /* Map from source location (decl_lineno) to profile (count_info). */ typedef std::map position_count_map; @@ -430,8 +428,7 @@ const function_instance *function_instance::get_fu int func_name_idx = afdo_function_name_map->get_index_by_decl (decl); if (func_name_idx != -1) { - callsite_map::const_iterator ret = callsites.find ( - std::make_pair (lineno, func_name_idx)); + callsite_map::const_iterator ret = callsites.find (lineno); if (ret != callsites.end ()) return ret->second; } @@ -439,8 +436,7 @@ const function_instance *function_instance::get_fu lang_hooks.dwarf_name (decl, 0)); if (func_name_idx != -1) { - callsite_map::const_iterator ret = callsites.find ( - std::make_pair (lineno, func_name_idx)); + callsite_map::const_iterator ret = callsites.find (lineno); if (ret != callsites.end ()) return ret->second; } @@ -500,10 +496,7 @@ const function_instance *function_instance::read_f } for (unsigned i = 0; i < num_callsites; i++) { unsigned offset = gcov_read_unsigned (); - const function_instance *callee_function_instance = - read_function_instance (stack, 0); - s->callsites[std::make_pair (offset, callee_function_instance->name ())] = - callee_function_instance; + s->callsites[offset] = read_function_instance (stack, 0); } stack->pop_back(); return s;