re PR tree-optimization/81203 (tail recursion: internal compiler error: verify_ssa...
authorRichard Biener <rguenther@suse.de>
Mon, 26 Jun 2017 10:33:12 +0000 (10:33 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 26 Jun 2017 10:33:12 +0000 (10:33 +0000)
2017-06-26  Richard Biener  <rguenther@suse.de>

PR tree-optimization/81203
* tree-tailcall.c (find_tail_calls): Do not move stmts into
non-dominating BBs.

* gcc.dg/torture/pr81203.c: New testcase.

From-SVN: r249644

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr81203.c [new file with mode: 0644]
gcc/tree-tailcall.c

index 41d5f57a78bab6df517f7383681a605abd2d135e..27ed3f9f04e23cbf6c58ce8cab6de100070995dd 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/81203
+       * tree-tailcall.c (find_tail_calls): Do not move stmts into
+       non-dominating BBs.
+
 2017-06-26  Marek Polacek  <polacek@redhat.com>
 
        PR c/80116
index 0a5b8a823a73adbedce48bee5936f011cb92bb67..9f9c123fdcc806e8fd9924d72c6bab6a49cf1464 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/81203
+       * gcc.dg/torture/pr81203.c: New testcase.
+
 2017-06-26  Marek Polacek  <polacek@redhat.com>
 
        PR c/80116
diff --git a/gcc/testsuite/gcc.dg/torture/pr81203.c b/gcc/testsuite/gcc.dg/torture/pr81203.c
new file mode 100644 (file)
index 0000000..5c9eaf5
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+int a;
+int b()
+{
+  int c, d;
+  if (a)
+    d = b();
+  return 1 + c + d;
+}
index 6aa9a56462e57c4edf7d1a70eae1ffe57e04683e..e0497e596bb0cad7ad29faf9036c90a597222157 100644 (file)
@@ -573,6 +573,11 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
        {
          if (! tail_recursion)
            return;
+         /* Do not deal with checking dominance, the real fix is to
+            do path isolation for the transform phase anyway, removing
+            the need to compute the accumulators with new stmts.  */
+         if (abb != bb)
+           return;
          for (unsigned opno = 1; opno < gimple_num_ops (stmt); ++opno)
            {
              tree op = gimple_op (stmt, opno);