From patchwork Thu Nov 3 15:04:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominik Vogt X-Patchwork-Id: 690887 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 3t8pDW2bmvz9sxS for ; Fri, 4 Nov 2016 02:05:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=aqjgwhRt; 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:date :from:to:cc:subject:reply-to:references:mime-version :content-type:in-reply-to:message-id; q=dns; s=default; b=th3Ccz 0pkZmfAL5z2c/g6vsSGTDFdurSd8RcNdGxrb7lnMOEpw4mxrhRc6S15DLHgCQhxU zk3xk2eizxwmb735QJz6IUX5XrSp0XRzxArmLpSvEiv2ih/HUTjlNB0M00IWQYSO AEOMNBlcr9SB6CrkRY8t62hI+6IDqE7QMCXho= 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:reply-to:references:mime-version :content-type:in-reply-to:message-id; s=default; bh=igt0BIze8mhL oQHrDIFhI6AU1IU=; b=aqjgwhRt1+7Lr0JJ9Cw/RwPCshsa1blT0YQ4hITf5ySV E4WBmCKc4mZe29oRzXqYBqq5mW5kOjCnqgi3CJf/joCQyGpXU4VNkb1V7xh0h2st OeLmGrfgLG6MFZDiJfvMrKdp5QbSd3UqluIeAnzAAZGlxjt6LinSZPmTsaJoo60= Received: (qmail 92217 invoked by alias); 3 Nov 2016 15:05:06 -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 92189 invoked by uid 89); 3 Nov 2016 15:05:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=*stmt, ciao, sk:vogt@li, gcond X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 03 Nov 2016 15:05:04 +0000 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uA3F4MAA044824 for ; Thu, 3 Nov 2016 11:05:02 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 26g63np0jn-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 03 Nov 2016 11:05:02 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 3 Nov 2016 15:05:01 -0000 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 3 Nov 2016 15:04:58 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3CA5B2190023 for ; Thu, 3 Nov 2016 15:04:13 +0000 (GMT) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uA3F4wWF43450384 for ; Thu, 3 Nov 2016 15:04:58 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id uA3F4we9004616 for ; Thu, 3 Nov 2016 09:04:58 -0600 Received: from oc5510024614.ibm.com (dyn-9-152-224-33.boeblingen.de.ibm.com [9.152.224.33]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id uA3F4vhX004607; Thu, 3 Nov 2016 09:04:58 -0600 Received: by oc5510024614.ibm.com (Postfix, from userid 500) id D1DF617E80; Thu, 3 Nov 2016 16:04:57 +0100 (CET) Date: Thu, 3 Nov 2016 16:04:57 +0100 From: Dominik Vogt To: gcc-patches@gcc.gnu.org Cc: richard.guenther@gmail.com, Ulrich Weigand , Andreas Krebbel Subject: Re: [RFC] Check number of uses in simplify_cond_using_ranges(). Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: vogt@linux.vnet.ibm.com, gcc-patches@gcc.gnu.org, richard.guenther@gmail.com, Ulrich Weigand , Andreas Krebbel References: <20161103150322.GA3523@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20161103150322.GA3523@linux.vnet.ibm.com> User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16110315-0016-0000-0000-00000259C259 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16110315-0017-0000-0000-000023A63693 Message-Id: <20161103150457.GA11773@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-03_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611030279 On Thu, Nov 03, 2016 at 04:03:22PM +0100, Dominik Vogt wrote: > I've been trying to fix some bad tree-ssa related optimisation for > s390x and come up with the attached experimental patch. The patch > is not really good - it breaks some situations in which the > optimisation was useful. With this code: ... Missing patch attached. Ciao Dominik ^_^ ^_^ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 3c75a0d..e74d935 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -9599,7 +9599,12 @@ simplify_cond_using_ranges (gcond *stmt) with strict overflow semantics. */ && ((!is_negative_overflow_infinity (vr->min) && !is_positive_overflow_infinity (vr->max)) - || TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (innerop)))) + || TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (innerop))) + /* If the only use of INNEROP is the cast to OP0, and OP0 is also + used in other places, folding would introduce new uses of the + otherwise dead INNEROP without eliminating OP0, so do not + fold. */ + && (!has_single_use (innerop) || has_single_use (op0))) { /* If the range overflowed and the user has asked for warnings when strict overflow semantics were used to optimize code,