From patchwork Mon Oct 3 19:14:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 77229 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1832135qgf; Mon, 3 Oct 2016 12:14:57 -0700 (PDT) X-Received: by 10.98.22.73 with SMTP id 70mr1709248pfw.36.1475522097420; Mon, 03 Oct 2016 12:14:57 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id m128si33890523pfb.137.2016.10.03.12.14.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Oct 2016 12:14:57 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-437589-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-437589-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-437589-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:from :subject:to:cc:message-id:date:mime-version:content-type; q=dns; s=default; b=hX9I/AUxD0rJcrZEThCuksDZ3R1HddwhI7kcQAY4lcxNSUm+nr kZUJ4l4OypACxHw4/l6e70TPWeERXNqhMP0IGpB7GzBiN0op7j3xy5x9oeDGoaiv 2xrO1t6Uqh1/0BLV6/Rt4qrIzwF59GtwECJSjaCIc6baAY9PGm2lkkMyU= 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:from :subject:to:cc:message-id:date:mime-version:content-type; s= default; bh=wu8qT45qVGVwQIF7sZm0iOeW3o8=; b=I+Y9eC/6+kD6b6WvlA/4 2VS7g15Wj/fwUMxgL7wvQ5yYcYiUSnuTjFEFt8uNvxk6WVKcMZKWK26td3FquMv2 yHLmSLThobczqb8FsZ9bzRVg9lnFgD74kkN4EY7z1FWPM+OW5ZIob3JQjnm0DAn3 O++iiZVpSPy7VWSw2aUMtns= Received: (qmail 12118 invoked by alias); 3 Oct 2016 19:14:39 -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 12107 invoked by uid 89); 3 Oct 2016 19:14:38 -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=4, 7, aos, H*RU:209.85.220.47, Hx-spam-relays-external:209.85.220.47 X-HELO: mail-pa0-f47.google.com Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Oct 2016 19:14:28 +0000 Received: by mail-pa0-f47.google.com with SMTP id rz1so9263577pab.1 for ; Mon, 03 Oct 2016 12:14:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version; bh=X+tpdpvFzj1BGGQmGr1hku05+p7mkR3otVci/fSQBzg=; b=DHtYIeD9MCRfuYyx05JRow4oAu2tWdZhjj19fqKxeXRndpsb6vVt5De4gVOHfYiD8x DxF1zd+W+okXBFelJKut60JZFA8qtsAa6iYzJdIhD6TiiVGWzk30P38GnYjfzbJosrGB rj1ydaHuBkoPoLLtI1YzPnNSkvVD65TX6+BIJDH6DpQC/NgALuiMOsjmLIjW9LVod/Y5 XP7kGbBpPEWZWUuFds4j1LQOkp8TGRAGkyvNVaB2BN7ijNpfXTl7UCUNJFTQhY7AnH9Q OcTzrPUH5/01/AsbGpR3Z4wTZ0+IkHrods3TZc+MlmzyjOn6t8BoD823YcE27vW/pHYg US+Q== X-Gm-Message-State: AA6/9RmLYYa/zLT4mAzlqkkUpk2FLuTtcLYCN0Kyc4HG/MSBcCEOLTsoT7QVd7ZXr4OFq7aF X-Received: by 10.66.27.165 with SMTP id u5mr800380pag.200.1475522066913; Mon, 03 Oct 2016 12:14:26 -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 p128sm49080492pfg.38.2016.10.03.12.14.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Oct 2016 12:14:25 -0700 (PDT) From: kugan Subject: [EVRP] Fold stmts with vrp_fold_stmt To: "gcc-patches@gcc.gnu.org" Cc: Richard Biener Message-ID: Date: Tue, 4 Oct 2016 06:14:21 +1100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, This patch improves Early VRP by folding stmts using vrp_fold_stmt as it is done in ssa_propagate for VRP. I have also changed EVRP to handle POINTER_TYPE_P. I will send follow up patches to use this in IPA-VRP. Bootstrapped and regression testd on x86_64-linux-gnu with no new regressions. Is this OK for trunk? Thanks, Kugan gcc/testsuite/ChangeLog: 2016-10-03 Kugan Vivekanandarajah * gcc.dg/pr68217.c: Adjust testcase as more cases are now handled in evrp. * gcc.dg/predict-1.c: Likewise. * gcc.dg/predict-9.c: Likewise. * gcc.dg/tree-ssa/pr20318.c: Likewise. * gcc.dg/tree-ssa/pr21001.c: Likewise. * gcc.dg/tree-ssa/pr21090.c: Likewise. * gcc.dg/tree-ssa/pr21294.c: Likewise. * gcc.dg/tree-ssa/pr21559.c: Likewise. * gcc.dg/tree-ssa/pr21563.c: Likewise. * gcc.dg/tree-ssa/pr23744.c: Likewise. * gcc.dg/tree-ssa/pr25382.c: Likewise. * gcc.dg/tree-ssa/pr61839_1.c: Likewise. * gcc.dg/tree-ssa/pr68431.c: Likewise. * gcc.dg/tree-ssa/vrp03.c: Likewise. * gcc.dg/tree-ssa/vrp07.c: Likewise. * gcc.dg/tree-ssa/vrp09.c: Likewise. * gcc.dg/tree-ssa/vrp17.c: Likewise. * gcc.dg/tree-ssa/vrp18.c: Likewise. * gcc.dg/tree-ssa/vrp19.c: Likewise. * gcc.dg/tree-ssa/vrp20.c: Likewise. * gcc.dg/tree-ssa/vrp23.c: Likewise. * gcc.dg/tree-ssa/vrp24.c: Likewise. * gcc.dg/tree-ssa/vrp58.c: Likewise. * gcc.dg/tree-ssa/vrp92.c: Likewise. * gcc.dg/tree-ssa/vrp98.c: Likewise. * gcc.dg/vrp-min-max-1.c: Likewise. gcc/ChangeLog: 2016-10-03 Kugan Vivekanandarajah * tree-vrp.c (evrp_dom_walker::before_dom_children): Handle POINTER_TYPE_P. Also fold stmts with vrp_fold_stmt. >From 4bb16e7d01674461a47e6b6488b04fb1907234ea Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Mon, 3 Oct 2016 06:12:05 +1100 Subject: [PATCH 1/5] Fold stmts using vrp_fold in evrp --- gcc/testsuite/gcc.dg/pr68217.c | 4 ++-- gcc/testsuite/gcc.dg/predict-1.c | 2 +- gcc/testsuite/gcc.dg/predict-9.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr20318.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/pr21001.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr21090.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/pr21294.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/pr21559.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr21563.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr23744.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/pr25382.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/pr61839_1.c | 6 +++--- gcc/testsuite/gcc.dg/tree-ssa/pr68431.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp03.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/vrp07.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp09.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/vrp17.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/vrp18.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/vrp19.c | 6 +++--- gcc/testsuite/gcc.dg/tree-ssa/vrp20.c | 6 +++--- gcc/testsuite/gcc.dg/tree-ssa/vrp23.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp24.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp58.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp92.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/vrp98.c | 2 +- gcc/testsuite/gcc.dg/vrp-min-max-1.c | 2 +- gcc/tree-vrp.c | 27 ++++++++++++++++++++------- 27 files changed, 62 insertions(+), 49 deletions(-) diff --git a/gcc/testsuite/gcc.dg/pr68217.c b/gcc/testsuite/gcc.dg/pr68217.c index 426a99a..fbe4627 100644 --- a/gcc/testsuite/gcc.dg/pr68217.c +++ b/gcc/testsuite/gcc.dg/pr68217.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fdump-tree-evrp" } */ int foo (void) { @@ -11,4 +11,4 @@ int foo (void) return 0; } -/* { dg-final { scan-tree-dump "\\\[-INF, 0\\\]" "vrp1" } } */ +/* { dg-final { scan-tree-dump "\\\[-INF, 0\\\]" "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/predict-1.c b/gcc/testsuite/gcc.dg/predict-1.c index 10d62ba..0d14802 100644 --- a/gcc/testsuite/gcc.dg/predict-1.c +++ b/gcc/testsuite/gcc.dg/predict-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-profile_estimate" } */ +/* { dg-options "-O2 -fno-tree-vrp -fdump-tree-profile_estimate" } */ extern int global; diff --git a/gcc/testsuite/gcc.dg/predict-9.c b/gcc/testsuite/gcc.dg/predict-9.c index 196e31c..8833cb3 100644 --- a/gcc/testsuite/gcc.dg/predict-9.c +++ b/gcc/testsuite/gcc.dg/predict-9.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-profile_estimate" } */ +/* { dg-options "-O2 -fno-tree-vrp -fdump-tree-profile_estimate" } */ extern int global; extern int global2; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20318.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20318.c index 41f569e..11d4f0d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr20318.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20318.c @@ -1,5 +1,5 @@ /* { dg-do compile { target { ! keeps_null_pointer_checks } } } */ -/* { dg-options "-O2 -fdump-tree-original -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */ +/* { dg-options "-O2 -fdump-tree-original -fdump-tree-evrp -fdelete-null-pointer-checks" } */ extern int* f(int) __attribute__((returns_nonnull)); extern void eliminate (); @@ -14,4 +14,4 @@ void h () { } /* { dg-final { scan-tree-dump-times "== 0" 1 "original" } } */ -/* { dg-final { scan-tree-dump-times "Folding predicate\[^\\n\]*to 0" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate\[^\\n\]*to 0" 1 "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c index 482d530..719360a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21001.c @@ -5,7 +5,7 @@ range information out of the conditional. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-dominator-opts -fno-tree-fre -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fno-tree-fre -fdisable-tree-evrp -fdump-tree-vrp1-details" } */ int foo (int a) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c index 26d0d55..12e0104 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21090.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */ +/* { dg-options "-O2 -fdump-tree-evrp -fdelete-null-pointer-checks" } */ int g, h; @@ -19,4 +19,4 @@ foo (int a) return 0; } -/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "evrp" { target { ! keeps_null_pointer_checks } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21294.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21294.c index f694fb2..91b36e6 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21294.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21294.c @@ -4,7 +4,7 @@ allows us to eliminate the second "if" statement. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-evrp" } */ struct f { int i; @@ -19,4 +19,4 @@ foo (struct f *p) return 0; } -/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */ +/* { dg-final { scan-tree-dump-times "if" 1 "evrp"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c index 0906351..d73b587 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21559.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1-details" } */ static int blocksize = 4096; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21563.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21563.c index 2cc2599..9c67a3a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21563.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21563.c @@ -2,7 +2,7 @@ Make sure VRP folds the second "if" statement. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdisable-tree-evrp -fdump-tree-vrp1-details" } */ int foo (int a) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c index 9d662f2..5f7d0b8 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr23744.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-evrp" } */ void h (void); @@ -17,4 +17,4 @@ int g (int i, int j) return 1; } -/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr25382.c b/gcc/testsuite/gcc.dg/tree-ssa/pr25382.c index dcf9148..0d19d0d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr25382.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr25382.c @@ -3,7 +3,7 @@ Check that VRP now gets ranges from BIT_AND_EXPRs. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-evrp" } */ int foo (int a) @@ -15,4 +15,4 @@ foo (int a) return 1; } -/* { dg-final { scan-tree-dump-times "Folding predicate b_.* > 300 to 0" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate b_.* > 300 to 0" 1 "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr61839_1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr61839_1.c index 9f8168a..9fcc35b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr61839_1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr61839_1.c @@ -1,6 +1,6 @@ /* PR tree-optimization/61839. */ /* { dg-do run } */ -/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-evrp -fdump-tree-optimized" } */ /* { dg-require-effective-target int32plus } */ __attribute__ ((noinline)) @@ -38,7 +38,7 @@ int main () } /* Scan for c = 972195717) >> [0, 1] in function foo. */ -/* { dg-final { scan-tree-dump-times "486097858 : 972195717" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "486097858 : 972195717" 1 "evrp" } } */ /* Scan for c = 972195717) >> [2, 3] in function bar. */ -/* { dg-final { scan-tree-dump-times "243048929 : 121524464" 2 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "243048929 : 121524464" 1 "evrp" } } */ /* { dg-final { scan-tree-dump-times "486097858" 0 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr68431.c b/gcc/testsuite/gcc.dg/tree-ssa/pr68431.c index 3bd3843..9c42563b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr68431.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr68431.c @@ -1,5 +1,5 @@ /* PR tree-optimization/68431 */ -/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1-details" } */ unsigned int x = 1; int diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp03.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp03.c index 59146bf..5e87195 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp03.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp03.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fdump-tree-evrp -fdump-tree-vrp1" } */ struct A { @@ -32,4 +32,4 @@ foo (struct A *p, struct A *q) } /* { dg-final { scan-tree-dump-times "Folding predicate q_.*to 1" 1 "vrp1" } } */ -/* { dg-final { scan-tree-dump-times "Folding predicate r_.*to 1" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate r_.*to 1" 1 "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c index a5bd670..725bcc1 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */ +/* { dg-options "-O2 -fdisable-tree-evrp -fno-tree-fre -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */ int foo (int i, int *p) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c index d42a566..c2b2d65 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp09.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1 -std=gnu89" } */ +/* { dg-options "-O2 -fno-tree-fre -fdump-tree-evrp -std=gnu89" } */ foo (int *p) { @@ -27,4 +27,4 @@ L78: } } -/* { dg-final { scan-tree-dump-times "Folding predicate p_.. != 0B to 1" 2 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate p_..... != 0B to 1" 2 "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp17.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp17.c index 4f12103..b8470e7 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp17.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp17.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fdump-tree-evrp" } */ extern void abort (void) __attribute__ ((__noreturn__)); union tree_node; @@ -27,5 +27,5 @@ gimplify_for_stmt (tree stmt) abort (); } -/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp18.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp18.c index 008eebb..d7ab3f6 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp18.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp18.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fdump-tree-evrp" } */ static int blocksize = 4096; @@ -30,4 +30,4 @@ void foo (void) eof_reached = 1; } -/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp19.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp19.c index cecacb6..3d47bfd 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp19.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp19.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-fwrapv -O1 -ftree-vrp -fdump-tree-vrp1" } */ +/* { dg-options "-fwrapv -O1 -ftree-vrp -fdump-tree-evrp" } */ #include extern void abort (); @@ -22,5 +22,5 @@ int g (int b) { } return 1; } -/* { dg-final { scan-tree-dump "Folding predicate a_. < 0 to 0" "vrp1" } } */ -/* { dg-final { scan-tree-dump "Folding predicate b_. >= 0 to 1" "vrp1" } } */ +/* { dg-final { scan-tree-dump "Folding predicate a_. < 0 to 0" "evrp" } } */ +/* { dg-final { scan-tree-dump "Folding predicate b_. >= 0 to 1" "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c index 60d1731..a844b94 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp20.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-fwrapv -O1 -fno-tree-fre -ftree-vrp -fdump-tree-vrp1" } */ +/* { dg-options "-fwrapv -O1 -fno-tree-fre -ftree-vrp -fdump-tree-evrp" } */ extern void abort (); extern void exit (int); @@ -23,5 +23,5 @@ int g (int b) { return 1; } -/* { dg-final { scan-tree-dump "Folding predicate a_. == 0 to 0" "vrp1" } } */ -/* { dg-final { scan-tree-dump "Folding predicate b_. != 0 to 1" "vrp1" } } */ +/* { dg-final { scan-tree-dump "Folding predicate a_.... == 0 to 0" "evrp" } } */ +/* { dg-final { scan-tree-dump "Folding predicate b_.... != 0 to 1" "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp23.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp23.c index ae68c090..855e8f1 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp23.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp23.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-forwprop -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fdisable-tree-evrp -fno-tree-forwprop -fdump-tree-vrp1-details" } */ void aa (void); void aos (void); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c index 853ee21..1cdd763 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-forwprop -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fdisable-tree-evrp -fno-tree-forwprop -fdump-tree-vrp1-details" } */ struct rtx_def; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp58.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp58.c index 5b44ae2..ff9835c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp58.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp58.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1-details" } */ long long foo (long long a, signed char b, signed char c) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c index 5d53750..213aa47 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1-details -fdisable-tree-ethread" } */ +/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1-details -fdisable-tree-ethread" } */ void bar (void); int foo (int i, int j) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp98.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp98.c index 982f091..704295a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp98.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp98.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target int128 } */ -/* { dg-options "-Os -fdump-tree-vrp1-details" } */ +/* { dg-options "-Os -fdump-tree-vrp1-details -fdisable-tree-evrp" } */ #include #include diff --git a/gcc/testsuite/gcc.dg/vrp-min-max-1.c b/gcc/testsuite/gcc.dg/vrp-min-max-1.c index 270f2bb..375d8d3 100644 --- a/gcc/testsuite/gcc.dg/vrp-min-max-1.c +++ b/gcc/testsuite/gcc.dg/vrp-min-max-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-mergephi2" } */ +/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fdump-tree-mergephi2" } */ int bar (void); diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 7a08be7..f5d8154 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -10666,7 +10666,8 @@ evrp_dom_walker::before_dom_children (basic_block bb) && gimple_code (stmt) == GIMPLE_COND && (op0 = gimple_cond_lhs (stmt)) && TREE_CODE (op0) == SSA_NAME - && INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (stmt)))) + && (INTEGRAL_TYPE_P (TREE_TYPE (gimple_cond_lhs (stmt))) + || POINTER_TYPE_P (TREE_TYPE (gimple_cond_lhs (stmt))))) { /* Entering a new scope. Try to see if we can find a VR here. */ @@ -10749,12 +10750,23 @@ evrp_dom_walker::before_dom_children (basic_block bb) set_defs_to_varying (stmt); /* Try folding stmts with the VR discovered. */ - bool did_replace - = replace_uses_in (stmt, - op_with_constant_singleton_value_range); - if (fold_stmt (&gsi, follow_single_use_edges) - || did_replace) - update_stmt (gsi_stmt (gsi)); + bool did_replace = false; + if (vrp_fold_stmt (&gsi)) + { + did_replace = true; + stmt = gsi_stmt (gsi); + update_stmt (stmt); + } + + did_replace + |= replace_uses_in (stmt, + op_with_constant_singleton_value_range); + + if (did_replace) + { + fold_stmt (&gsi, follow_single_use_edges); + stmt = gsi_stmt (gsi); + } if (did_replace) { @@ -10776,6 +10788,7 @@ evrp_dom_walker::before_dom_children (basic_block bb) if (TREE_CODE (rhs) == ADDR_EXPR) recompute_tree_invariant_for_addr_expr (rhs); } + update_stmt (gsi_stmt (gsi)); } def_operand_p def_p = SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF); -- 2.7.4