From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129084 invoked by alias); 26 Jun 2017 10:31:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 128519 invoked by uid 89); 26 Jun 2017 10:31:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Jun 2017 10:31:47 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E54C0AC05 for ; Mon, 26 Jun 2017 10:31:44 +0000 (UTC) Date: Mon, 26 Jun 2017 10:31:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR81203 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2017-06/txt/msg01906.txt.bz2 Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2017-06-26 Richard Biener 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; +}