diff options
author | Richard Biener <rguenther@suse.de> | 2016-07-26 13:10:33 +0000 |
---|---|---|
committer | Prathamesh Kulkarni <prathamesh3492@gcc.gnu.org> | 2016-07-26 13:10:33 +0000 |
commit | 8f63caf6826e918678482413161e34b037a13fa7 (patch) | |
tree | b13c6e8ce4b86039e91187312d3fd3205772dd46 /gcc/testsuite | |
parent | c4f820552a06d38c06d1b9d9806052accad88b54 (diff) | |
download | gcc-8f63caf6826e918678482413161e34b037a13fa7.zip gcc-8f63caf6826e918678482413161e34b037a13fa7.tar.gz gcc-8f63caf6826e918678482413161e34b037a13fa7.tar.bz2 |
re PR middle-end/70920 (if ((intptr_t)ptr == 0) doesn't get simplified to if (ptr == 0))
2016-07-26 Richard Biener <rguenther@suse.de>
Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
PR middle-end/70920
* match.pd ((intptr)x eq/ne CST to x eq/ne (typeof x) CST): New
pattern.
testsuite/
* gcc.dg/pr70920-1.c: New test-case.
* gcc.dg/pr70902-2.c: Likewise.
* gcc.dg/pr70920-3.c: Likewise.
* gcc.dg/pr70920-4.c: Likewise
* gcc.dg/tree-ssa/ssa-dom-branch-1.c: Change scan-tree-dump-times to
2 instead of 3.
Co-Authored-By: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
From-SVN: r238754
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr70920-1.c | 20 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr70920-2.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr70920-3.c | 20 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr70920-4.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-branch-1.c | 4 |
6 files changed, 95 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 19ea0ed..b63a79c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2016-07-26 Richard Biener <rguenther@suse.de> + Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> + + PR middle-end/70920 + * gcc.dg/pr70920-1.c: New test-case. + * gcc.dg/pr70902-2.c: Likewise. + * gcc.dg/pr70920-3.c: Likewise. + * gcc.dg/pr70920-4.c: Likewise + * gcc.dg/tree-ssa/ssa-dom-branch-1.c: Change scan-tree-dump-times to + 2 instead of 3. + 2016-07-25 Alexander Monakov <amonakov@ispras.ru> * gcc.c-torture/execute/pr71494.c: Require label_values. diff --git a/gcc/testsuite/gcc.dg/pr70920-1.c b/gcc/testsuite/gcc.dg/pr70920-1.c new file mode 100644 index 0000000..9b7e2d0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr70920-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple" } */ + +#include <stdint.h> + +void f1(); +void f2(); + +void +foo (int *a) +{ + if ((intptr_t) a == 0) + { + f1 (); + if (a) + f2 (); + } +} + +/* { dg-final { scan-tree-dump "if \\(a == 0B\\)" "gimple" } } */ diff --git a/gcc/testsuite/gcc.dg/pr70920-2.c b/gcc/testsuite/gcc.dg/pr70920-2.c new file mode 100644 index 0000000..2db9897 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr70920-2.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-forwprop-details" } */ + +#include <stdint.h> + +void f1(); +void f2(); + +void +foo (int *a) +{ + int cst = 0; + if ((intptr_t) a == cst) + { + f1 (); + if (a) + f2 (); + } +} + +/* { dg-final { scan-tree-dump "gimple_simplified to if \\(a_\[0-9\]*\\(D\\) == 0B\\)" "forwprop1" } } */ diff --git a/gcc/testsuite/gcc.dg/pr70920-3.c b/gcc/testsuite/gcc.dg/pr70920-3.c new file mode 100644 index 0000000..8b24cbc --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr70920-3.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-gimple -Wno-int-to-pointer-cast" } */ + +#include <stdint.h> + +void f1(); +void f2(); + +void +foo (int a) +{ + if ((int *) a == 0) + { + f1 (); + if (a) + f2 (); + } +} + +/* { dg-final { scan-tree-dump "if \\(a == 0\\)" "gimple" } } */ diff --git a/gcc/testsuite/gcc.dg/pr70920-4.c b/gcc/testsuite/gcc.dg/pr70920-4.c new file mode 100644 index 0000000..dedb895 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr70920-4.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-ccp-details -Wno-int-to-pointer-cast" } */ + +#include <stdint.h> + +void f1(); +void f2(); + +void +foo (int a) +{ + void *cst = 0; + if ((int *) a == cst) + { + f1 (); + if (a) + f2 (); + } +} + +/* { dg-final { scan-tree-dump "gimple_simplified to if \\(_\[0-9\]* == 0\\)" "ccp1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-branch-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-branch-1.c index 18f9041..3c15296 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-branch-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-branch-1.c @@ -19,9 +19,9 @@ try_combine (rtx i1, rtx newpat) else if (i1 && foo ()); } -/* There should be three tests against i1. Two from the hash table +/* There should be two tests against i1. One from the hash table dumps, one in the code itself. */ -/* { dg-final { scan-tree-dump-times "if .i1_" 3 "dom2"} } */ +/* { dg-final { scan-tree-dump-times "if .i1_" 2 "dom2"} } */ /* There should be no actual jump threads realized by DOM. The legitimize jump threads are handled in VRP and those discovered |