diff options
author | Richard Biener <rguenther@suse.de> | 2016-08-12 12:58:15 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-08-12 12:58:15 +0000 |
commit | e373dd067e6f29cd333cddd741611f5979718c58 (patch) | |
tree | 9f4ca179884496904f5a175a84357487283ad659 /gcc/testsuite/gcc.dg | |
parent | 20d1af89b40d0a939a7afefeecf6652bd587e18b (diff) | |
download | gcc-e373dd067e6f29cd333cddd741611f5979718c58.zip gcc-e373dd067e6f29cd333cddd741611f5979718c58.tar.gz gcc-e373dd067e6f29cd333cddd741611f5979718c58.tar.bz2 |
re PR tree-optimization/57326 (Piecewise folding of operations on PHI nodes)
2016-08-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/57326
* tree-ssa-pre.c (fully_constant_expression): Handle simplification
returning an SSA name.
(phi_translate_1): When fully_constant_expression returns a NAME
make sure we have a leader for it.
* gcc.dg/tree-ssa/ssa-pre-32.c: New testcase.
* gcc.dg/tree-ssa/loadpre14.c: Adjust.
* gcc.dg/tree-ssa/pr35287.c: Likewise.
* gcc.target/i386/pr45685.c: Likewise.
* gcc.dg/tree-ssa/predcom-1.c: Disable PRE.
* gcc.dg/tree-ssa/predcom-2.c: Likewise.
* gcc.dg/tree-ssa/predcom-3.c: Likewise.
* gcc.dg/tree-ssa/ssa-sink-10.c: Likewise.
* gfortran.dg/pr34163.f90: Likewise.
From-SVN: r239414
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/loadpre14.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr35287.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/predcom-3.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-32.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c | 2 |
7 files changed, 24 insertions, 11 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loadpre14.c b/gcc/testsuite/gcc.dg/tree-ssa/loadpre14.c index 989d933..456c89f 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loadpre14.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loadpre14.c @@ -6,7 +6,8 @@ int foo(type *a, int argc) type c = {0, 1}; int d, e; - /* Should be able to eliminate the second load of *a along the main path. */ + /* Should be able to eliminate the second load of *a and the add of zero + along the main path. */ d = (*a)[0]; if (argc) { @@ -15,4 +16,4 @@ int foo(type *a, int argc) e = (*a)[0]; return d + e; } -/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */ +/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "pre"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr35287.c b/gcc/testsuite/gcc.dg/tree-ssa/pr35287.c index b091ba8..f7cc5c0 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr35287.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr35287.c @@ -10,5 +10,6 @@ int foo(int p) return (*gp + t); } -/* We will eliminate one load of gp and one indirect load of *gp. */ -/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "pre"} } */ +/* We will eliminate one load of gp and one indirect load of *gp and + the add of zero. */ +/* { dg-final { scan-tree-dump-times "Eliminated: 3" 1 "pre"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c index 062b3da..4bc2ea5 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-do run } */ -/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */ +/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details -fno-tree-pre" } */ void abort (void); @@ -45,6 +45,6 @@ int main(void) /* Verify that both loops were transformed and unrolled. */ /* { dg-final { scan-tree-dump-times "Unrolling 2 times." 2 "pcom"} } */ -/* Also check that we undid the transformation previously made by PRE. */ -/* { dg-final { scan-tree-dump-times "looparound ref" 1 "pcom"} } */ - +/* Also check that we undid the transformation previously made by PRE. + ??? PRE now does the predictive commoning in count_averages. */ +/* dg-final { scan-tree-dump-times "looparound ref" 1 "pcom" } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c index 0d92f8e..d8fe51c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */ +/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details -fno-tree-pre" } */ void abort (void); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-3.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-3.c index bfddb79..1174cd1 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/predcom-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */ +/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details -fno-tree-pre" } */ int a[1000], b[1000]; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-32.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-32.c new file mode 100644 index 0000000..d9bd3a9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-32.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre" } */ + +unsigned f(unsigned x, unsigned y, _Bool b) +{ +#define m (b?-1:0) + return (x&m)|(y&~m); +#undef m +} + +/* { dg-final { scan-tree-dump "# prephitmp_\[0-9\]+ = PHI <\[xy\]_\[0-9\]+\\(D\\)\[^,\]*, \[xy\]_\[0-9\]+\\(D\\)" "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c index 4031e10..37e4d2f 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-10.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-sink-details" } */ +/* { dg-options "-O2 -fdump-tree-sink-details -fno-tree-pre" } */ int x[1024], y[1024], z[1024], w[1024]; void foo (void) |