From patchwork Thu Sep 24 17:16:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teresa Johnson X-Patchwork-Id: 522442 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 082601401CD for ; Fri, 25 Sep 2015 03:16:43 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=t8s15TmL; dkim-atps=neutral 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=jJN7ZxUW2sIaABPJvmaNa0PeOfg+TlBCSaF7HvcZ/cf p/ilkJbEiTJ/qqmvGZKPrF52wpqNjAxpkjhYfiXv/wwfIEmxdCl8EgOrzCnjX7cM T0KIJ0HXj41+5Q4nsBHOZeNtqK0XAf2fnrhkgwodBVn59HHr+xfp4VGYQ2MA9YAY = 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=T77c4Z0lf2kIGciel2rplNyvhzg=; b=t8s15TmLYehsXi74P d99/QRV0JxbujlwuP+xVJ02D8sahsS47DqO9wPdQPfaB41Iin4f6iwaFkHVlMHTV geLP21YnWaxWZ/BEGjx11OL8Uc0LERQVaxTATDiCP9bkD9/ZTDPIS6+WiPfsc8bK ijKWCpHeD8Epox7j/wN8k0RxYA= Received: (qmail 84434 invoked by alias); 24 Sep 2015 17:16:32 -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 84259 invoked by uid 89); 24 Sep 2015 17:16:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 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-ig0-f180.google.com Received: from mail-ig0-f180.google.com (HELO mail-ig0-f180.google.com) (209.85.213.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 24 Sep 2015 17:16:27 +0000 Received: by igbkq10 with SMTP id kq10so126127646igb.0 for ; Thu, 24 Sep 2015 10:16:25 -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=lWbvPelrWPfN38zAUkBO17yI7tnQDdFweOflhFp4mps=; b=iCuCmlTBpi4JQL1q6lQjEdjrMF7M6FR4jJHprNnn7Frszux3pG9G2AONRDLrNJ+1LP WskHgU8Nt122R6CSW7hvcxxaTLjsPa4iXKwMZO6ztIm6JyHPVvd9zrYZ99SqnkS+beUM An7ARPSbFKrntu4cjrza5gE3idRY+9iYcTNePVHmZhpQqm7j+jaC5oylZ8bBJfBvVTuX 5dmgiwU73mjZjGUwOB6rMnRkjahl+dFeLjL2Vea7Unc06QiOwBCkam7jGxgp1YNDX3cN qNIhuB/re+h+v2/ud6npSUO8EQdCi4nEZZRR5F5IiV0ryuUNvxpGT74Kk0GbyvP2lgy8 rkvQ== X-Gm-Message-State: ALoCoQmpU4WzCqSBOIQJpaQboTvpBw6LiKbMsJ4H35m3TJx8NsszoXCnYy/lZ6olOYafzL5wT3xJ MIME-Version: 1.0 X-Received: by 10.50.93.42 with SMTP id cr10mr29269171igb.19.1443114984791; Thu, 24 Sep 2015 10:16:24 -0700 (PDT) Received: by 10.107.34.203 with HTTP; Thu, 24 Sep 2015 10:16:24 -0700 (PDT) Date: Thu, 24 Sep 2015 10:16:24 -0700 Message-ID: Subject: [PATCH] Disable -fno-reorder-blocks-and-partition if no -fprofile-use to avoid unnecessary overhead From: Teresa Johnson To: "gcc-patches@gcc.gnu.org" , Jan Hubicka Cc: Xinliang David Li X-IsSubscribed: yes This patch unsets -freorder-blocks-and-partition when -fprofile-use is not specified. Function splitting was not actually being performed in that case, as probably_never_executed_bb_p does not distinguish any basic blocks as being cold vs hot when there is no profile data. Leaving it enabled, however, causes the assembly code generator to create (empty) cold sections and labels, leading to unnecessary size overhead. Bootstrapped and tested on x86-64-unknown-linux-gnu. Ok for trunk? Thanks, Teresa 2015-09-24 Teresa Johnson * opts.c (finish_options): Unset -freorder-blocks-and-partition if not using profile. Index: opts.c =================================================================== --- opts.c (revision 228062) +++ opts.c (working copy) @@ -821,7 +821,17 @@ finish_options (struct gcc_options *opts, struct g opts->x_flag_reorder_blocks = 1; } + /* Disable -freorder-blocks-and-partition when -fprofile-use is not in + effect. Function splitting was not actually being performed in that case, + as probably_never_executed_bb_p does not distinguish any basic blocks as + being cold vs hot when there is no profile data. Leaving it enabled, + however, causes the assembly code generator to create (empty) cold + sections and labels, leading to unnecessary size overhead. */ if (opts->x_flag_reorder_blocks_and_partition + && !opts_set->x_flag_profile_use) + opts->x_flag_reorder_blocks_and_partition = 0; + + if (opts->x_flag_reorder_blocks_and_partition && !opts_set->x_flag_reorder_functions) opts->x_flag_reorder_functions = 1;