diff options
author | Richard Guenther <rguenther@suse.de> | 2008-01-25 12:08:52 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-01-25 12:08:52 +0000 |
commit | 59805c3b29f62c729aa176eea03bbd20b455b7e5 (patch) | |
tree | 510264dd523185479bb68185f5a6fa8cda2c5808 /gcc | |
parent | 57e2aff267801c94a26098f7cb7b1e9bc054b854 (diff) | |
download | gcc-59805c3b29f62c729aa176eea03bbd20b455b7e5.zip gcc-59805c3b29f62c729aa176eea03bbd20b455b7e5.tar.gz gcc-59805c3b29f62c729aa176eea03bbd20b455b7e5.tar.bz2 |
re PR tree-optimization/34966 (ICE: verify_ssa fails when optimization trigonometric code)
2008-01-25 Richard Guenther <rguenther@suse.de>
PR tree-optimization/34966
* tree-ssa-math-opts.c (execute_cse_sincos_1): For all but
default defs and PHI_NODEs we have to insert after the
defining statement.
* gcc.c-torture/compile/pr34966.c: New testcase.
From-SVN: r131824
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr34966.c | 17 | ||||
-rw-r--r-- | gcc/tree-ssa-math-opts.c | 5 |
4 files changed, 32 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f506a07..80a4ee6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-01-25 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/34966 + * tree-ssa-math-opts.c (execute_cse_sincos_1): For all but + default defs and PHI_NODEs we have to insert after the + defining statement. + 2008-01-24 Nick Clifton <nickc@redhat.com> * config/stormy16/stormy16-lib2.c (MIN_UNITS_PER_WORD): diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 858acf9..407d42d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2008-01-25 Richard Guenther <rguenther@suse.de> + PR tree-optimization/34966 + * gcc.c-torture/compile/pr34966.c: New testcase. + +2008-01-25 Richard Guenther <rguenther@suse.de> + PR c++/33887 * g++.dg/torture/pr33887-1.C: New testcase. * g++.dg/torture/pr33887-2.C: Likewise. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34966.c b/gcc/testsuite/gcc.c-torture/compile/pr34966.c new file mode 100644 index 0000000..9d68da7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr34966.c @@ -0,0 +1,17 @@ +extern double sin (double), cos (double); + +__inline double +atan (double __x) +{ + register double __result; + __asm __volatile__ ("" : "=t" (__result) : "0" (__x)); + return __result; +} + +double +f(double x) +{ + double t = atan (x); + return cos (t) + sin (t); +} + diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 5a7bf8b..087cca2 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -661,8 +661,9 @@ execute_cse_sincos_1 (tree name) call = build_call_expr (fndecl, 1, name); stmt = build_gimple_modify_stmt (res, call); def_stmt = SSA_NAME_DEF_STMT (name); - if (bb_for_stmt (def_stmt) == top_bb - && TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT) + if (!SSA_NAME_IS_DEFAULT_DEF (name) + && TREE_CODE (def_stmt) != PHI_NODE + && bb_for_stmt (def_stmt) == top_bb) { bsi = bsi_for_stmt (def_stmt); bsi_insert_after (&bsi, stmt, BSI_SAME_STMT); |