From patchwork Mon Sep 30 13:31:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 279154 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 E7F9B2C00AC for ; Mon, 30 Sep 2013 23:31:39 +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:reply-to:mime-version :content-type; q=dns; s=default; b=Z6NsGrGfQIMUDwXeub3AUS1s04hit E7FQPqqRH66Nsv7ByngJ1FIRREn63o7TUQFYcQ0rukZb6xSGjzu7Dp6EMikgM1kM yk6wJfA5RFL8/Q23MJpDoXIEMN2D0pswDtDlaXSA9DFk1I28pNK5Gt6UMtigSmnw C6FsIxdh5UYtuU= 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:reply-to:mime-version :content-type; s=default; bh=hgcN7BU26Ac1y3dRgJ60xBBQeTQ=; b=xcJ MeoDJY2DAYw3cLrjoWfbFfyngGDVglVosAgeOFHRSfGvfxtt5PDXcfq6tNVwu8ut Ijj7GPG0ee64lExuORmVSle+ztGKuW1Fqs2s0WsiLRyvtlOoihbPJ4xdqHIIEepP I0dgU+kQlzv+zuhBF439pu9f/PQXohrzFycbSkuQ= Received: (qmail 28375 invoked by alias); 30 Sep 2013 13:31:33 -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 28365 invoked by uid 89); 30 Sep 2013 13:31:33 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 30 Sep 2013 13:31:33 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8UDVU5I003521 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 30 Sep 2013 09:31:31 -0400 Received: from tucnak.zalov.cz (vpn1-4-169.ams2.redhat.com [10.36.4.169]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r8UDVSKM015682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 30 Sep 2013 09:31:29 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.7/8.14.7) with ESMTP id r8UDVRWt032429; Mon, 30 Sep 2013 15:31:27 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.7/8.14.7/Submit) id r8UDVOG3032428; Mon, 30 Sep 2013 15:31:24 +0200 Date: Mon, 30 Sep 2013 15:31:24 +0200 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Improve tree_unary_nonnegative_warnv_p (PR middle-end/58564) Message-ID: <20130930133124.GV30970@tucnak.zalov.cz> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi! Related to the last patch, this handles also BOOLEAN_TYPE and ENUMERAL_TYPE the same as INTEGER_TYPE in tree_unary_nonnegative_warnv_p, which means we e.g. fold properly the (int) (x != 0 && y != 0) < 0 when (x != 0 && y != 0) has BOOLEAN_TYPE. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2013-09-30 Jakub Jelinek PR middle-end/58564 * fold-const.c (tree_unary_nonnegative_warnv_p): Use INTEGRAL_TYPE_P (t) instead of TREE_CODE (t) == INTEGER_TYPE. Jakub --- gcc/fold-const.c.jj 2013-09-30 11:19:06.000000000 +0200 +++ gcc/fold-const.c 2013-09-30 11:47:40.984561868 +0200 @@ -15448,7 +15448,7 @@ tree_unary_nonnegative_warnv_p (enum tre if (TREE_CODE (inner_type) == REAL_TYPE) return tree_expr_nonnegative_warnv_p (op0, strict_overflow_p); - if (TREE_CODE (inner_type) == INTEGER_TYPE) + if (INTEGRAL_TYPE_P (inner_type)) { if (TYPE_UNSIGNED (inner_type)) return true; @@ -15456,12 +15456,12 @@ tree_unary_nonnegative_warnv_p (enum tre strict_overflow_p); } } - else if (TREE_CODE (outer_type) == INTEGER_TYPE) + else if (INTEGRAL_TYPE_P (outer_type)) { if (TREE_CODE (inner_type) == REAL_TYPE) return tree_expr_nonnegative_warnv_p (op0, strict_overflow_p); - if (TREE_CODE (inner_type) == INTEGER_TYPE) + if (INTEGRAL_TYPE_P (inner_type)) return TYPE_PRECISION (inner_type) < TYPE_PRECISION (outer_type) && TYPE_UNSIGNED (inner_type); }