From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 171533AA9423; Mon, 12 Dec 2022 11:21:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 171533AA9423 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670844063; bh=phWiwrZHBnoP1vUAKFfkR4aKUtJiE6M5+CwKbQ0quns=; h=From:To:Subject:Date:From; b=o605waR56koIl8pJ24vyspGRplvijfa+p6nFRO0hOpEWBsREuwJshv08S+hGwpKTt EGHI8FUYBPzB0E8ZXlsFvJMLq+LpUmh+zI5YS2N2CgmiwX4NIyuNfcE/xG0+Fzuacc SiGqnuHYoeS3Q/6DIN3pS09ZQsRiIVdiigh5Z8a4= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-8978] tree-optimization/107865 - ICE with outlining of loops X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: 812847a9d12c0b65695cbe1a23959b69a7e62355 X-Git-Newrev: 09469705318de7a0fe5f10f5d5b92870d3fada6e Message-Id: <20221212112103.171533AA9423@sourceware.org> Date: Mon, 12 Dec 2022 11:21:03 +0000 (GMT) List-Id: https://gcc.gnu.org/g:09469705318de7a0fe5f10f5d5b92870d3fada6e commit r12-8978-g09469705318de7a0fe5f10f5d5b92870d3fada6e Author: Richard Biener Date: Fri Nov 25 08:27:42 2022 +0100 tree-optimization/107865 - ICE with outlining of loops The following makes sure to clear loops number of iterations when outlining them as part of a SESE region as can happen with auto-parallelization. The referenced SSA names become stale otherwise. PR tree-optimization/107865 * tree-cfg.cc (move_sese_region_to_fn): Free the number of iterations of moved loops. * gfortran.dg/graphite/pr107865.f90: New testcase. (cherry picked from commit bcc2449384f2092cbdf5d6ac2357aeabe3212b2e) Diff: --- gcc/testsuite/gfortran.dg/graphite/pr107865.f90 | 18 ++++++++++++++++++ gcc/tree-cfg.cc | 2 ++ 2 files changed, 20 insertions(+) diff --git a/gcc/testsuite/gfortran.dg/graphite/pr107865.f90 b/gcc/testsuite/gfortran.dg/graphite/pr107865.f90 new file mode 100644 index 00000000000..6bddb17a1be --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/pr107865.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! { dg-options "-O1 -floop-parallelize-all -ftree-parallelize-loops=2" } + + SUBROUTINE FNC (F) + + IMPLICIT REAL (A-H) + DIMENSION F(N) + + DO I = 1, 6 + DO J = 1, 6 + IF (J .NE. I) THEN + F(I) = F(I) + 1 + END IF + END DO + END DO + + RETURN + END diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index c0824e34802..05fc4514714 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -7737,6 +7737,8 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, if (bb->loop_father->header == bb) { class loop *this_loop = bb->loop_father; + /* Avoid the need to remap SSA names used in nb_iterations. */ + free_numbers_of_iterations_estimates (this_loop); class loop *outer = loop_outer (this_loop); if (outer == loop /* If the SESE region contains some bbs ending with