From patchwork Fri Aug 22 14:51:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 382238 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 0A3A8140076 for ; Sat, 23 Aug 2014 00:51:26 +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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=ccUHRzZ5Dx221I5Ae Id0ELi/VcF45nPHpaKKln5/aT1SqKs+Y2Jtt1UsyMvqrXkcu6aQNFPanSspjFFNx XA6ySmX17m3BV04mIzn9j2mAq5Lt+SpKKhpiqN3sBC5Ztokcbgeq439JYEjuPKct Yda5wQE/ohQDtI0ZUM6D2PkcgY= 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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=39+VGfmzWViCWhfju70d4ei ee+o=; b=Yet6G9MK/Zw7lNbzVB7AYMcKDk/S74t8O/x8s9CfP+NYO4a83Onnx75 PAGrW4AHTyKpZAiNzjbDr31NkbIsY3BA/CWfn8ZZdb8/aE33TeWp1FN/9lBXDkGq 0NM4BQIvEenAtiBKsRkbkfGhZhrI0QhCiZItMFsJ9Qtn8/F590tI= Received: (qmail 25398 invoked by alias); 22 Aug 2014 14:51:19 -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 25388 invoked by uid 89); 22 Aug 2014 14:51:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 22 Aug 2014 14:51:17 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7MEpGJJ001990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 22 Aug 2014 10:51:16 -0400 Received: from redhat.com (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7MEpCMu005666 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Fri, 22 Aug 2014 10:51:15 -0400 Date: Fri, 22 Aug 2014 16:51:11 +0200 From: Marek Polacek To: Vladimir Makarov Cc: GCC Patches Subject: Re: [PATCH] Fix condition in ira-color.c and lra-spills.c (PR c/61271) Message-ID: <20140822145111.GC15033@redhat.com> References: <20140821180145.GU14320@redhat.com> <53F64AB1.4080902@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <53F64AB1.4080902@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) On Thu, Aug 21, 2014 at 03:38:25PM -0400, Vladimir Makarov wrote: > Sorry, Marek. I guess it is wrong. STACK_GROWS_DOWNWARD is only 0 or 1 > in these files (it is achieved by redefinition of STACK_GROWS_DOWNWARD > in the files). FAME_GROWS_DOWNWARD can be 0 or anything non-zero (even > non-constant) as tm.texi contains > > @defmac FRAME_GROWS_DOWNWARD > Define this macro to nonzero value if the addresses of local variable slots > are at negative offsets from the frame pointer. > @end defmac > > It works now as all machine description files use 1 as non-zero value. > > So the documentation should be changed but it is not wise, error prune, > and right now the macro value can be non-constant during compilation > time theoretically. Whoops, that is sneaky, thanks for the exaplanation. > So you need another way to transform the expressions to get rid of the > warning. > > As I remember the code was actually taken from the old RA and not simple > as it looks. So what we can do is to just wrap the LHS of the comparison in parens; this ought to suppress the warning. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2014-08-22 Marek Polacek PR c/61271 * ira-color.c (coalesced_pseudo_reg_slot_compare): Wrap LHS of a comparison in parens. * lra-spills.c (pseudo_reg_slot_compare): Wrap LHS of a comparison in parens. Marek diff --git gcc/ira-color.c gcc/ira-color.c index 36c3c87..e2ea359 100644 --- gcc/ira-color.c +++ gcc/ira-color.c @@ -3850,7 +3850,7 @@ coalesced_pseudo_reg_slot_compare (const void *v1p, const void *v2p) slot_num2 = -ALLOCNO_HARD_REGNO (a2); if ((diff = slot_num1 - slot_num2) != 0) return (frame_pointer_needed - || !FRAME_GROWS_DOWNWARD == STACK_GROWS_DOWNWARD ? diff : -diff); + || (!FRAME_GROWS_DOWNWARD) == STACK_GROWS_DOWNWARD ? diff : -diff); total_size1 = MAX (PSEUDO_REGNO_BYTES (regno1), regno_max_ref_width[regno1]); total_size2 = MAX (PSEUDO_REGNO_BYTES (regno2), diff --git gcc/lra-spills.c gcc/lra-spills.c index 50f63fc..38a81e6 100644 --- gcc/lra-spills.c +++ gcc/lra-spills.c @@ -237,7 +237,7 @@ pseudo_reg_slot_compare (const void *v1p, const void *v2p) slot_num2 = pseudo_slots[regno2].slot_num; if ((diff = slot_num1 - slot_num2) != 0) return (frame_pointer_needed - || !FRAME_GROWS_DOWNWARD == STACK_GROWS_DOWNWARD ? diff : -diff); + || (!FRAME_GROWS_DOWNWARD) == STACK_GROWS_DOWNWARD ? diff : -diff); total_size1 = GET_MODE_SIZE (lra_reg_info[regno1].biggest_mode); total_size2 = GET_MODE_SIZE (lra_reg_info[regno2].biggest_mode); if ((diff = total_size2 - total_size1) != 0)