From patchwork Wed Sep 18 23:51:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 275833 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 C91692C00F7 for ; Thu, 19 Sep 2013 09:51:35 +1000 (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:cc:content-type; q=dns; s=default; b=uG90gX2PX2pZoMLJf2+M+U1P7jEHNzqMKpYHsY9Ufqf RsQAbaTvQJE3pH3+FFL5eehW/vrheP/lIcr93u4h6rF8dJdyt3klWEKz4B1Vx5SC RulyqDVpTvkmoCu/B0W1xWGo8BenWqwFG+UX3N1pN89IcV7pciFjicCZ92ZGSdFY = 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:cc:content-type; s=default; bh=eJQqaJ7Qsimz6/HMjzug+AxRNWU=; b=pcSnzANxNwlxZK+Jx +/ZdwBBKsgSXwN+YDDomjS76X3b2J0F4VhzeJgXlf80290cD0OQod9KUuCxAV0aE g9OwP+nBdVDNTqpb8z0uV8KyFvvuKNqHGMHjar9Dad/j5sRuWWaaByn0Ks0s6rXD M5gjfNFve90bZIWDoD2XEFiNpk= Received: (qmail 4952 invoked by alias); 18 Sep 2013 23:51:29 -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 4932 invoked by uid 89); 18 Sep 2013 23:51:29 -0000 Received: from mail-ie0-f179.google.com (HELO mail-ie0-f179.google.com) (209.85.223.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 18 Sep 2013 23:51:29 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, NO_RELAYS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f179.google.com Received: by mail-ie0-f179.google.com with SMTP id e14so13338188iej.24 for ; Wed, 18 Sep 2013 16:51:26 -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:cc :content-type; bh=Lf06IPT22oMzA0xItqh9hBi40+sSznnG1Btx4N8BzTw=; b=QKIw/2tu/SIGRhfeI6HSUIq5uM4wzdF88x4L0SKZLZI2kxpkBD1bOj6LyJ+x5x0rfg 8gmmbL1FYp+oUmN08HTW0k90pzo52yKEp6VEkqSHqplG0Er1Hs9eOFVNcvdsPoByGZJ6 MevMCd5HNRsSIU0vAjjvFh3mxj+BBArqMICEXjU3oaNU4XQjMuwMivC+cbmxi5KblUvb wH5fp56wZYgMchrhg1DbNg5Wb9tglsSGIi5+PyIHGG0x9MiCjJMzFpaUCN0C1TayjiRh 4G5Bh+iVU0xwmsxTaSQ+L4PtYUiW5JUouLA3z894X6LzOOYDbk/r6psmlkNNZ/MsiEOA J/UQ== X-Gm-Message-State: ALoCoQkSAwJ/aHiuWetdEiZM0AxixcvA/Qp7l0/zVcMRvQrKv8DDQDZgA6HU8QHnJU2Ts3uKJXjqRCl2dqBGRjfGQJRiiLSxGofrU+xhFyLGZoCkWuboxFFv9rBehd5uFkgxjoCPZNgQg3+ou8JGWymcACOmQQ1dgeHUCYn09OhT3Wdnf24B3NVynowymrRCJJl1QdTWL6QSvS13RcvUHZGn+vCpu/V/bQ== MIME-Version: 1.0 X-Received: by 10.42.250.148 with SMTP id mo20mr91104icb.34.1379548286343; Wed, 18 Sep 2013 16:51:26 -0700 (PDT) Received: by 10.64.9.133 with HTTP; Wed, 18 Sep 2013 16:51:26 -0700 (PDT) Date: Wed, 18 Sep 2013 16:51:26 -0700 Message-ID: Subject: [GOOGLE] Patch to fix AutoFDO LIPO performance regression From: Dehao Chen To: GCC Patches Cc: David Li X-IsSubscribed: yes This patch fixup the call graph edge targets during AutoFDO pass, so that when rebuilding call graph edges, it can find the correct callee. Bootstrapped and passed regression test. Benchmark tests on-going. Ok for google-4_8 branch? Thanks, Dehao Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 202725) +++ gcc/Makefile.in (working copy) @@ -2960,7 +2960,7 @@ coverage.o : coverage.c $(GCOV_IO_H) $(CONFIG_H) $ auto-profile.o : auto-profile.c $(CONFIG_H) $(SYSTEM_H) $(FLAGS_H) \ $(BASIC_BLOCK_H) $(DIAGNOSTIC_CORE_H) $(GCOV_IO_H) $(INPUT_H) profile.h \ $(LANGHOOKS_H) $(OPTS_H) $(TREE_PASS_H) $(CGRAPH_H) $(GIMPLE_H) value-prof.h \ - $(COVERAGE_H) coretypes.h $(TREE_H) $(PARAMS_H) $(AUTO_PROFILE_H) + $(COVERAGE_H) coretypes.h $(TREE_H) $(PARAMS_H) l-ipo.h $(AUTO_PROFILE_H) cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h dumpfile.h $(TM_H) $(RTL_H) \ $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h $(RECOG_H) \ $(EMIT_RTL_H) $(DIAGNOSTIC_CORE_H) $(FUNCTION_H) \ Index: gcc/auto-profile.c =================================================================== --- gcc/auto-profile.c (revision 202725) +++ gcc/auto-profile.c (working copy) @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "value-prof.h" #include "coverage.h" #include "params.h" +#include "l-ipo.h" #include "auto-profile.h" /* The following routines implements AutoFDO optimization. @@ -1290,6 +1291,13 @@ auto_profile (void) init_node_map (); profile_info = autofdo::afdo_profile_info; + cgraph_pre_profiling_inlining_done = true; + cgraph_process_module_scope_statics (); + /* Now perform link to allow cross module inlining. */ + cgraph_do_link (); + varpool_do_link (); + cgraph_unify_type_alias_sets (); + FOR_EACH_FUNCTION (node) { if (!gimple_has_body_p (node->symbol.decl)) @@ -1301,6 +1309,21 @@ auto_profile (void) push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); + if (L_IPO_COMP_MODE) + { + basic_block bb; + FOR_EACH_BB (bb) + { + gimple_stmt_iterator gsi; + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + if (is_gimple_call (stmt)) + lipo_fixup_cgraph_edge_call_target (stmt); + } + } + } + autofdo::afdo_annotate_cfg (); compute_function_frequency (); update_ssa (TODO_update_ssa); @@ -1309,13 +1332,6 @@ auto_profile (void) pop_cfun (); } - cgraph_pre_profiling_inlining_done = true; - cgraph_process_module_scope_statics (); - /* Now perform link to allow cross module inlining. */ - cgraph_do_link (); - varpool_do_link (); - cgraph_unify_type_alias_sets (); - return TODO_rebuild_cgraph_edges; }