]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/gcc-tumbl.git/commitdiff
Backported from mainline
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Sep 2012 15:58:51 +0000 (15:58 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Sep 2012 15:58:51 +0000 (15:58 +0000)
2012-09-17  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/54563
* tree-ssa-math-opts.c (execute_cse_sincos): Call
gimple_purge_dead_eh_edges if last call has been changed.

* g++.dg/torture/pr54563.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@191571 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr54563.C [new file with mode: 0644]
gcc/tree-ssa-math-opts.c

index f8646686356b69e5eb5bd68555a6cf38189d2552..6b8f6d6eff0725a29fd302fc2c1a242c7ed5f21e 100644 (file)
@@ -1,6 +1,12 @@
 2012-09-20  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2012-09-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/54563
+       * tree-ssa-math-opts.c (execute_cse_sincos): Call
+       gimple_purge_dead_eh_edges if last call has been changed.
+
        2012-09-14  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/54564
index 2d88614b17d28ffb01368b46056b9144e2e5effb..fee7540225d59ea7160f696ac8cccb3138f40194 100644 (file)
@@ -1,3 +1,11 @@
+2012-09-20  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2012-09-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/54563
+       * g++.dg/torture/pr54563.C: New test.
+
 2012-09-20  Release Manager
 
        * GCC 4.7.2 released.
diff --git a/gcc/testsuite/g++.dg/torture/pr54563.C b/gcc/testsuite/g++.dg/torture/pr54563.C
new file mode 100644 (file)
index 0000000..2980320
--- /dev/null
@@ -0,0 +1,14 @@
+// PR tree-optimization/54563
+// { dg-do compile }
+
+extern "C" float powf (float, float);
+struct S { ~S (); };
+double bar ();
+double x;
+
+void
+foo ()
+{
+  S s;
+  x = powf (bar (), 2.);
+}
index a00541fbdf5471245076a3b88b08d6932e8f5d77..bb60a62fe046a430867ccce925e1420ef92946f6 100644 (file)
@@ -1,5 +1,5 @@
 /* Global, SSA-based optimizations using mathematical identities.
-   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -1387,12 +1387,18 @@ execute_cse_sincos (void)
   FOR_EACH_BB (bb)
     {
       gimple_stmt_iterator gsi;
+      bool cleanup_eh = false;
 
       for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
         {
          gimple stmt = gsi_stmt (gsi);
          tree fndecl;
 
+         /* Only the last stmt in a bb could throw, no need to call
+            gimple_purge_dead_eh_edges if we change something in the middle
+            of a basic block.  */
+         cleanup_eh = false;
+
          if (is_gimple_call (stmt)
              && gimple_call_lhs (stmt)
              && (fndecl = gimple_call_fndecl (stmt))
@@ -1430,6 +1436,7 @@ execute_cse_sincos (void)
                      gimple_set_location (new_stmt, loc);
                      unlink_stmt_vdef (stmt);
                      gsi_replace (&gsi, new_stmt, true);
+                     cleanup_eh = true;
                    }
                  break;
 
@@ -1450,6 +1457,7 @@ execute_cse_sincos (void)
                      gimple_set_location (new_stmt, loc);
                      unlink_stmt_vdef (stmt);
                      gsi_replace (&gsi, new_stmt, true);
+                     cleanup_eh = true;
                    }
                  break;
 
@@ -1465,6 +1473,7 @@ execute_cse_sincos (void)
                      gimple_set_location (new_stmt, loc);
                      unlink_stmt_vdef (stmt);
                      gsi_replace (&gsi, new_stmt, true);
+                     cleanup_eh = true;
                    }
                  break;
 
@@ -1472,6 +1481,8 @@ execute_cse_sincos (void)
                }
            }
        }
+      if (cleanup_eh)
+       cfg_changed |= gimple_purge_dead_eh_edges (bb);
     }
 
   statistics_counter_event (cfun, "sincos statements inserted",