diff options
author | Richard Guenther <rguenther@suse.de> | 2011-05-02 13:11:27 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-05-02 13:11:27 +0000 |
commit | 90bc462321f77fb63a04bb3d73bfa54267087b26 (patch) | |
tree | 2bebdc1626ad94e349f185dd860edaef39f741f1 /gcc | |
parent | 9fd15228e24f6f1420437deeac052dd7342444a4 (diff) | |
download | gcc-90bc462321f77fb63a04bb3d73bfa54267087b26.zip gcc-90bc462321f77fb63a04bb3d73bfa54267087b26.tar.gz gcc-90bc462321f77fb63a04bb3d73bfa54267087b26.tar.bz2 |
re PR tree-optimization/48822 (G++ gets stucks and never finishes compilation when enabling -O2/3 optimization options.)
2011-05-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48822
* tree-ssa-sccvn.c (set_ssa_val_to): Never go up the lattice.
(process_scc): Indicate which iteration we start.
* gcc.dg/torture/pr48822.c: New testcase.
From-SVN: r173250
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr48822.c | 20 | ||||
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 28 |
4 files changed, 52 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6a8d393..8d20385 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-05-02 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/48822 + * tree-ssa-sccvn.c (set_ssa_val_to): Never go up the lattice. + (process_scc): Indicate which iteration we start. + 2011-05-02 Jan Hubicka <jh@suse.cz> * lto-section-in.c (lto_input_1_unsigned): Move to lto-streamer.h diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 769d865..02722cf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-05-02 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/48822 + * gcc.dg/torture/pr48822.c: New testcase. + 2011-05-02 Paolo Carlini <paolo.carlini@oracle.com> PR c++/47969 diff --git a/gcc/testsuite/gcc.dg/torture/pr48822.c b/gcc/testsuite/gcc.dg/torture/pr48822.c new file mode 100644 index 0000000..b619f36 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr48822.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +void foo (int *, int *); +int bar () +{ + int a = 0; + int b = 0; + if (b != 0) + { + int ax = a; + int bx = b; + while (bx != 0) + { + int tem = ax % bx; + ax = bx; + bx = tem; + } + } + foo (&a, &b); +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index ab56e3d..8f96d6c 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2241,12 +2241,26 @@ print_scc (FILE *out, VEC (tree, heap) *scc) static inline bool set_ssa_val_to (tree from, tree to) { - tree currval; + tree currval = SSA_VAL (from); - if (from != to - && TREE_CODE (to) == SSA_NAME - && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (to)) - to = from; + if (from != to) + { + if (currval == from) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "Not changing value number of "); + print_generic_expr (dump_file, from, 0); + fprintf (dump_file, " from VARYING to "); + print_generic_expr (dump_file, to, 0); + fprintf (dump_file, "\n"); + } + return false; + } + else if (TREE_CODE (to) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (to)) + to = from; + } /* The only thing we allow as value numbers are VN_TOP, ssa_names and invariants. So assert that here. */ @@ -2263,8 +2277,6 @@ set_ssa_val_to (tree from, tree to) print_generic_expr (dump_file, to, 0); } - currval = SSA_VAL (from); - if (currval != to && !operand_equal_p (currval, to, OEP_PURE_SAME)) { VN_INFO (from)->valnum = to; @@ -3280,6 +3292,8 @@ process_scc (VEC (tree, heap) *scc) { changed = false; iterations++; + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "Starting iteration %d\n", iterations); /* As we are value-numbering optimistically we have to clear the expression tables and the simplified expressions in each iteration until we converge. */ |