From patchwork Fri May 16 20:58:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dehao Chen X-Patchwork-Id: 349760 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 BE465140090 for ; Sat, 17 May 2014 06:58:22 +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=LO9FaYNO35rmsmZCHNDgOfpCIlAI3TT9nCYThZWdN4T neMfOHVD5CWWdB7RXMjBX/2HNCDOZTVoCj6FFRPD/7lY9Z3RolUQZD247zT/Sebo h0thwAWczKlptSZOngynDJaURIxlk0Mluaj8/6ZGaLSYbBZBjmYypiXsURatKIK4 = 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=VX6zEkhqoX9iYtBLox6LlvaZn5E=; b=PsTqb08jbsHtmqZyZ YTZLIytzAc89rlHZw/a59ig/qQ8+P8aLN9wVtIV8zHiTJmhtml1VMAw88wstj/+O CmMtEK8ikOTmqYjdnbETZfmMtfFGR4owqFjIEjIv6dvlxrzCd8YUgJ9SVapdwlMV FTRJEVTODbJ9bOoY1E07w4u9cM= Received: (qmail 14244 invoked by alias); 16 May 2014 20:58:16 -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 14230 invoked by uid 89); 16 May 2014 20:58:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 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-f182.google.com Received: from mail-ie0-f182.google.com (HELO mail-ie0-f182.google.com) (209.85.223.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 16 May 2014 20:58:12 +0000 Received: by mail-ie0-f182.google.com with SMTP id to1so212826ieb.27 for ; Fri, 16 May 2014 13:58:10 -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=omavEeSE5DZYt81JOP+6SyWFxJh08PVeKazSzgGsyBQ=; b=TZJbbW+IrxykUA9OAmQrwGjZ7m4td638raT3HfweL+N8m+XXjHClbadkl52LvEwA/D 5saaLv9bGPE/IDJV2dKbygKyJS2JFD3sVQY7hS7G/P8POZwOYlSNKqm29IHIILWiIH2F 86dZsp0cwD9TXLpcJfGsUKXca5ORpvJ4rCYQ0CRshPaQdtG0LWq8gV3yokW7/Y7pjxt9 knaZUb+bo+IQAOwWsFyHZuzRNN4u4fJDD/XiHLbQu1WZ0G/SmKJsHp/KYovEeC8KT1Vf H9NMlSKygoCkKe6x09tqnbRdcKZByGtMmvWdLNy6qcu6RHhSyh0BeoVfM4mgBfp4ncGi cpAA== X-Gm-Message-State: ALoCoQlK9jKNh4GSvQjMnboJg5X954Zhp+l5dAPtj6+PLetlt3BVclEy51pVFMzzLe7Rl/K/pKb8 MIME-Version: 1.0 X-Received: by 10.42.90.11 with SMTP id i11mr18924720icm.26.1400273890363; Fri, 16 May 2014 13:58:10 -0700 (PDT) Received: by 10.64.18.180 with HTTP; Fri, 16 May 2014 13:58:10 -0700 (PDT) Date: Fri, 16 May 2014 13:58:10 -0700 Message-ID: Subject: [PATCH] Use optimize_function_for_size_p to assign register frequency From: Dehao Chen To: GCC Patches Cc: Jan Hubicka , David Li X-IsSubscribed: yes This patch uses optimize_function_for_size_p to replace old optimize_size check in regs.h and ira-int.h to make it consistent. Bootstrapped and testing on-going. OK for trunk if test passes? Thanks, Dehao gcc/ChangeLog: 2014-05-16 Dehao Chen * ira-int.h (REG_FREQ_FROM_EDGE_FREQ): Use optimize_function_for_size_p. * regs.h (REG_FREQ_FROM_BB): Likewise. Index: gcc/ira-int.h =================================================================== --- gcc/ira-int.h (revision 210527) +++ gcc/ira-int.h (working copy) @@ -42,9 +42,8 @@ along with GCC; see the file COPYING3. If not see profile driven feedback is available and the function is never executed, frequency is always equivalent. Otherwise rescale the edge frequency. */ -#define REG_FREQ_FROM_EDGE_FREQ(freq) \ - (optimize_size || (flag_branch_probabilities \ - && !ENTRY_BLOCK_PTR_FOR_FN (cfun)->count) \ +#define REG_FREQ_FROM_EDGE_FREQ(freq) \ + (optimize_function_for_size_p (cfun) \ ? REG_FREQ_MAX : (freq * REG_FREQ_MAX / BB_FREQ_MAX) \ ? (freq * REG_FREQ_MAX / BB_FREQ_MAX) : 1) Index: gcc/regs.h =================================================================== --- gcc/regs.h (revision 210527) +++ gcc/regs.h (working copy) @@ -135,9 +135,7 @@ extern size_t reg_info_p_size; or profile driven feedback is available and the function is never executed, frequency is always equivalent. Otherwise rescale the basic block frequency. */ -#define REG_FREQ_FROM_BB(bb) (optimize_size \ - || (flag_branch_probabilities \ - && !ENTRY_BLOCK_PTR_FOR_FN (cfun)->count) \ +#define REG_FREQ_FROM_BB(bb) (optimize_function_for_size_p (cfun) \ ? REG_FREQ_MAX \ : ((bb)->frequency * REG_FREQ_MAX / BB_FREQ_MAX)\ ? ((bb)->frequency * REG_FREQ_MAX / BB_FREQ_MAX)\