This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR81203
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 26 Jun 2017 12:31:44 +0200 (CEST)
- Subject: [PATCH] Fix PR81203
- Authentication-results: sourceware.org; auth=none
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
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.
Index: gcc/tree-tailcall.c
===================================================================
--- gcc/tree-tailcall.c (revision 249638)
+++ gcc/tree-tailcall.c (working copy)
@@ -573,6 +573,11 @@ find_tail_calls (basic_block bb, struct
{
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);
Index: gcc/testsuite/gcc.dg/torture/pr81203.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr81203.c (nonexistent)
+++ gcc/testsuite/gcc.dg/torture/pr81203.c (working copy)
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+int a;
+int b()
+{
+ int c, d;
+ if (a)
+ d = b();
+ return 1 + c + d;
+}