From patchwork Wed Oct 12 06:56:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 77534 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp325244qge; Tue, 11 Oct 2016 23:56:53 -0700 (PDT) X-Received: by 10.66.146.39 with SMTP id sz7mr12944967pab.36.1476255413439; Tue, 11 Oct 2016 23:56:53 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id j9si6467547pao.105.2016.10.11.23.56.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Oct 2016 23:56:53 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-438287-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-438287-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-438287-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=L/9Ltlo+rfL+WXT2q +yeGGZmOq1nBcGZkYw5+RZMPQWHevv0tTVllBmzprNDSPlcSWER2RFdE/mfNjzIm rNpEGPfJWAUbaRGPUudPyokp6y/I707kTye6g5J3LQhjnNd4N5UuJjQSq20XcKrn 13FX83JUW7mVsiq/zsi3RCXNUw= 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 :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=k/xORw5tUjXnuDDssEoVHdj ar4Y=; b=sNziJuVcXSJJYiL5PmaACGU7daMyhGywIvEF/mc7d31b/GEk6XMlv5F wteVBujHJzJZYweBO5zeetuMTOWBmE/533b84daQuuNW0ARcKIzQG1ZdQVC0QBiB 2Pus1CxlhUU4NrPsSOBbW+dY9tL7eU+4TiIiw8Z1BlD/fVwPX5vk= Received: (qmail 76952 invoked by alias); 12 Oct 2016 06:56:41 -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 76934 invoked by uid 89); 12 Oct 2016 06:56:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=noclone, get_ptr_nonnull, 6858, 685, 8 X-HELO: mail-pf0-f177.google.com Received: from mail-pf0-f177.google.com (HELO mail-pf0-f177.google.com) (209.85.192.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Oct 2016 06:56:30 +0000 Received: by mail-pf0-f177.google.com with SMTP id 190so14638890pfv.1 for ; Tue, 11 Oct 2016 23:56:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=WTbtRtDyvuUMtuLYOycVnwi/jF8vm0zgwBTkOCDsYEg=; b=G3maDFMDZHFdLc9Mky2xHDt2IR9bEsDI/7dIft7AsXInmXoA/JvhC6mXyx7QPxyfEq kTpJ0AIklB8XB6RuIUL0mRmo3Eqkw27X30RbA8sC/NZKw+a3TR7F8qy2es2khyh007kY Sss0bvjIVc1l7029l/uFz2H/63OQVhezAuBMRCKQym9RfLw75ImXMSkeuVNOfGkgh6WD LR/kivRRNFf8AK38HgEKXlUmk1DascyQdHyETkD264AGRtG9Eyz4hRYjEKjlV+sR7iCh HG6HxTCSaJdeUEM1pLiDyAnyzd2bVFakovofMkxVbL05g3rpZbn9c09fuGp/eg1X9i/i 79aw== X-Gm-Message-State: AA6/9Rmzd1WTCpWIpV4V7Gu+xgLBTrqNKvJAaF+o7XrJns66FoLnyEN39zJ+JolzqxQUGuMr X-Received: by 10.98.65.206 with SMTP id g75mr2911827pfd.55.1476255389095; Tue, 11 Oct 2016 23:56:29 -0700 (PDT) Received: from [10.1.1.7] (58-6-183-210.dyn.iinet.net.au. [58.6.183.210]) by smtp.gmail.com with ESMTPSA id d188sm8969766pfd.33.2016.10.11.23.56.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Oct 2016 23:56:28 -0700 (PDT) Subject: [vrp] use get_ptr_nonnull in tree-vrp To: "gcc-patches@gcc.gnu.org" , Richard Biener , Jeff Law References: <717fb095-f0a9-6980-ddbd-e755a4fd6457@linaro.org> From: kugan Message-ID: <2cfe50b8-1841-2b1a-9baa-1464cebd953b@linaro.org> Date: Wed, 12 Oct 2016 17:56:23 +1100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <717fb095-f0a9-6980-ddbd-e755a4fd6457@linaro.org> X-IsSubscribed: yes Hi, This patch uses get_ptr_nonnull in tree-vrp. Bootstrapped and regression tested this with other patched without any new regressions on x86_64-linux-gnu. Is this OK for trunk? Thanks, Kugan gcc/testsuite/ChangeLog: 2016-10-12 Kugan Vivekanandarajah * gcc.dg/ipa/vrp4.c: Adjust testcase. gcc/ChangeLog: 2016-10-12 Kugan Vivekanandarajah * tree-vrp.c (get_value_range): Check get_ptr_nonnull. >From 56e57ed72e44f22285d1f9de204ff8f98f6c08d2 Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Wed, 12 Oct 2016 13:54:58 +1100 Subject: [PATCH 3/3] Teach-vrp-to-use-ptr-nonnull --- gcc/testsuite/gcc.dg/ipa/vrp4.c | 3 ++- gcc/tree-vrp.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.dg/ipa/vrp4.c b/gcc/testsuite/gcc.dg/ipa/vrp4.c index d7e1f26..941f80e 100644 --- a/gcc/testsuite/gcc.dg/ipa/vrp4.c +++ b/gcc/testsuite/gcc.dg/ipa/vrp4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-ipa-cp-details" } */ +/* { dg-options "-O2 -fdump-ipa-cp-details -fdump-tree-vrp1" } */ static __attribute__((noinline, noclone)) int foo (int *p) @@ -25,3 +25,4 @@ int bar (struct st *s) } /* { dg-final { scan-ipa-dump "Setting nonnull for 0" "cp" } } */ +/* { dg-final { scan-tree-dump-times "if" 1 "vrp1" } } */ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 7e4f947..f9e5936 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -685,7 +685,8 @@ get_value_range (const_tree var) anti-ranges for pointers. Note that this is only valid with default definitions of PARM_DECLs. */ if (POINTER_TYPE_P (TREE_TYPE (sym)) - && nonnull_arg_p (sym)) + && (nonnull_arg_p (sym) + || get_ptr_nonnull (var))) set_value_range_to_nonnull (vr, TREE_TYPE (sym)); else if (INTEGRAL_TYPE_P (TREE_TYPE (sym))) { -- 2.7.4