From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1005) id E25233840C26; Thu, 6 Aug 2020 17:51:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E25233840C26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596736269; bh=Z82ddkZ0B07MPzDI4Gp8Q53CIZpjB0A4plTrH19tmTA=; h=From:To:Subject:Date:From; b=HHIxcWzdg5e2OWaF2LT+seMv+M2YoI4G8cTZzoISk7QpGs7+MZv2eUCtEvkypLVGS B+plnm3mWJlmIdm+OJtImBSvcngtmcKmRfae3biKv8+DmA0qMW1nO3dmqUFTveGGJd fmg3jzzHkolgu6HO3tNy5DKrO50pIYrj2m0mbDQA= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Michael Meissner To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/meissner/heads/work008-orig)] tree-optimization/96491 - avoid store commoning across abnormal edges X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/users/meissner/heads/work008-orig X-Git-Oldrev: 1f4c8afa1b2dac97f2ee78eacafe6eee246a4dae X-Git-Newrev: 89b84cd794f984038984c10b03c3b0ab582f49cc Message-Id: <20200806175109.E25233840C26@sourceware.org> Date: Thu, 6 Aug 2020 17:51:09 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 17:51:10 -0000 https://gcc.gnu.org/g:89b84cd794f984038984c10b03c3b0ab582f49cc commit 89b84cd794f984038984c10b03c3b0ab582f49cc Author: Richard Biener Date: Thu Aug 6 12:18:24 2020 +0200 tree-optimization/96491 - avoid store commoning across abnormal edges This avoids store commoning across abnormal edges since that easily can disrupt abnormal coalescing because it might create overlapping lifetime of variables. 2020-08-06 Richard Biener PR tree-optimization/96491 * tree-ssa-sink.c (sink_common_stores_to_bb): Avoid sinking across abnormal edges. * gcc.dg/torture/pr96491.c: New testcase. Diff: --- gcc/testsuite/gcc.dg/torture/pr96491.c | 29 +++++++++++++++++++++++++++++ gcc/tree-ssa-sink.c | 3 ++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/torture/pr96491.c b/gcc/testsuite/gcc.dg/torture/pr96491.c new file mode 100644 index 00000000000..784559f4754 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr96491.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ + +int rj; + +void __attribute__ ((returns_twice)) +da (void) +{ + rj = 1; +} + +void +c5 (void) +{ + for (;;) + ++rj; +} + +void +ls (int kz) +{ + if (kz == 0) + { + rj = 0; + c5 (); + } + + da (); + c5 (); +} diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c index 962ad076968..4cc5195f2f8 100644 --- a/gcc/tree-ssa-sink.c +++ b/gcc/tree-ssa-sink.c @@ -503,7 +503,8 @@ sink_common_stores_to_bb (basic_block bb) tree arg = gimple_phi_arg_def (phi, i); gimple *def = SSA_NAME_DEF_STMT (arg); if (! is_gimple_assign (def) - || stmt_can_throw_internal (cfun, def)) + || stmt_can_throw_internal (cfun, def) + || (gimple_phi_arg_edge (phi, i)->flags & EDGE_ABNORMAL)) { /* ??? We could handle some cascading with the def being another PHI. We'd have to insert multiple PHIs for