From patchwork Thu Nov 13 22:25:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 410632 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C32ED1400A0 for ; Fri, 14 Nov 2014 09:25:56 +1100 (AEDT) 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=sxMgJhnE0tKHb6DmpTTmFX1K5U/pS2cJC3TxS16fspjGLq UfbLVAT/n2h/e1kTCpzh4O/s8ytkS6GbpH7eaza93Td+Xck13xO2tOs9dzcLxmd0 gg662K3/PJwfHqy6iGr7Aldjs6dVLzGl/WJseHFI9qU+Ocklnm3jkGnY6MrBU= 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=82nFvnPeGf5baxb5CX4iDimolMw=; b=Bsw2A71L/cZxeVTp9vgY 6XWUmq9lR7xmks1387kEp7MCpKvr+G92m1WMMjOqL9SP+zkgiDTQPR1roLCREOGf 3YcgwP0oJjYltPXu+T9vJK5FNxsJgUsbRj+6T4DsPNi/etYoE34bBwM++9HNtGuf XGDVzuGRIDDOTu2J+7jAMww= Received: (qmail 18705 invoked by alias); 13 Nov 2014 22:25:48 -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 18695 invoked by uid 89); 13 Nov 2014 22:25:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 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-vc0-f179.google.com Received: from mail-vc0-f179.google.com (HELO mail-vc0-f179.google.com) (209.85.220.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 13 Nov 2014 22:25:47 +0000 Received: by mail-vc0-f179.google.com with SMTP id le20so2978528vcb.38 for ; Thu, 13 Nov 2014 14:25:44 -0800 (PST) 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=tTArxWK7pAqo9C3UgiEYU5SiSwklPuMzGii2wA9shXo=; b=JFUMG2JFTs2sJCeBNaZu5CqczLq1OC4+/jqNg6sIMEA83yldOS99dvCGl1QeYkGwNf +3QehfX6PtlNjhgy9HI9tywNX0+EiRiyT/+ZYy9iTzZw2TuXeAVXweikHfRaPnwfMAfy sCsFf3583cD2BNaDGIoyxgY678xpjRfnWERn7CYV6VGV/J7in2PSx80tQ9gBN3rGvxvW j1y+tAvdnjg+MNblCK9pGrehG5A5SG0fcGnKTCJQyz0vQHeC6SeCaPD+VErr5nt4hfbS JhxeyuUM5HnLbw9Ht8gm1V1jcKP0PkaQjCMs17dCVLHa3+chDJacxpS82iGwa1NVLhCv WFOw== X-Gm-Message-State: ALoCoQkNMHRTtbkmwNyrmPd4lDSEEQPwhct/kQJPJT14TuFRvxFZ+eeZnexfV7Ay6Kl6+ayevLgx MIME-Version: 1.0 X-Received: by 10.52.111.202 with SMTP id ik10mr2541565vdb.48.1415917544797; Thu, 13 Nov 2014 14:25:44 -0800 (PST) Received: by 10.52.115.129 with HTTP; Thu, 13 Nov 2014 14:25:44 -0800 (PST) Date: Thu, 13 Nov 2014 14:25:44 -0800 Message-ID: Subject: [GOOGLE] Fix AutoFDO size issue From: Dehao Chen To: GCC Patches , David Li X-IsSubscribed: yes In AutoFDO, we increase einline iterations. This could lead to extensive code bloat if we have recursive calls like: dtor() { destroy(node); } destroy(node) { destroy(left) destroy(right) } In this case, the size growth will be around 8 which is smaller than threshold (11). However, if we allow this to happen for 2 iterations, it will expand the size by 1024X. To fix this problem, we want to set a much smaller threshold in the AutoFDO case. This is because AutoFDO do not not rely on aggressive einline to gain more profile context. And also, in AutoFDO pass, after we processed a function, we need to recompute inline parameters because rebuild_cgraph_edges will zero out all inline parameters. The patch is attached below, bootstrapped and perf test on-going. OK for google-4_9? Thanks, Dehao Index: gcc/auto-profile.c =================================================================== --- gcc/auto-profile.c (revision 217523) +++ gcc/auto-profile.c (working copy) @@ -1771,6 +1771,7 @@ auto_profile (void) free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS); rebuild_cgraph_edges (); + compute_inline_parameters (cgraph_get_node (current_function_decl), true); pop_cfun (); } Index: gcc/opts.c =================================================================== --- gcc/opts.c (revision 217523) +++ gcc/opts.c (working copy) @@ -1853,6 +1853,12 @@ common_handle_option (struct gcc_options *opts, maybe_set_param_value ( PARAM_EARLY_INLINER_MAX_ITERATIONS, 10, opts->x_param_values, opts_set->x_param_values); + maybe_set_param_value ( + PARAM_EARLY_INLINING_INSNS, 4, + opts->x_param_values, opts_set->x_param_values); + maybe_set_param_value ( + PARAM_EARLY_INLINING_INSNS_COMDAT, 4, + opts->x_param_values, opts_set->x_param_values); value = true; /* No break here - do -fauto-profile processing. */ case OPT_fauto_profile: