From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix PR81203
Date: Mon, 26 Jun 2017 10:31:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.20.1706261231170.23185@zhemvz.fhfr.qr> (raw)
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;
+}
reply other threads:[~2017-06-26 10:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LSU.2.20.1706261231170.23185@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).