From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 1CBD6385841E for ; Fri, 25 Nov 2022 07:59:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1CBD6385841E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1989F21875 for ; Fri, 25 Nov 2022 07:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669363161; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=m9WsUACd97yvWqkW35xIr9Bmdy6Ijy0c4Vo9VRWZZBY=; b=KgkxJlnxYfMIgwNXKYfXo4nVOFh2BamHw5yx9J+UshciObli0BGVp6zCIxL66KYiQPWohr /DEycSnDLGNPBvoivxrP1jNL7hRc5kuxJcIIYPKZouD1wqLrN7UbB1XKiJkXlwN56xQW5m amf9iN0fGzI4RmRqUiXseNK6RpfuivA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669363161; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=m9WsUACd97yvWqkW35xIr9Bmdy6Ijy0c4Vo9VRWZZBY=; b=56SZR6DToDbahWsWHNm7jjjpd0iebeITK+L94RbxNE6DXzavs6fKIpSjA5NwpX55ijzrwN w6URwgNbCAP9sPDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0706813A08 for ; Fri, 25 Nov 2022 07:59:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id igmqANl1gGPvGQAAMHmgww (envelope-from ) for ; Fri, 25 Nov 2022 07:59:21 +0000 Date: Fri, 25 Nov 2022 08:59:20 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/107865 - ICE with outlining of loops MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Message-Id: <20221125075921.0706813A08@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. 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. --- .../gfortran.dg/graphite/pr107865.f90 | 18 ++++++++++++++++++ gcc/tree-cfg.cc | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/graphite/pr107865.f90 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 28175312afc..0c409b435fb 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -7859,6 +7859,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 -- 2.35.3