]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/34966 (ICE: verify_ssa fails when optimization trigonometric...
authorRichard Guenther <rguenther@suse.de>
Fri, 25 Jan 2008 12:08:52 +0000 (12:08 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 25 Jan 2008 12:08:52 +0000 (12:08 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr34966.c [new file with mode: 0644]
gcc/tree-ssa-math-opts.c

index f506a07351d4a85812deeca14d537b7d80c89347..80a4ee6a4206a5c2088d73f5971d60131ebb6f4f 100644 (file)
@@ -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):
index 858acf920838b267de65d53a6e8b916e2ff4294c..407d42db211f55d7e5f5330df82a55318d7d1721 100644 (file)
@@ -1,3 +1,8 @@
+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
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34966.c b/gcc/testsuite/gcc.c-torture/compile/pr34966.c
new file mode 100644 (file)
index 0000000..9d68da7
--- /dev/null
@@ -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);
+}
+
index 5a7bf8bc66dd839a097a0649efa00f429ded692c..087cca2c3d9ef8d032cadd7410a01e24b032846c 100644 (file)
@@ -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);