From patchwork Wed Nov 30 17:58:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 128546 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 4B582B6F6F for ; Thu, 1 Dec 2011 04:58:37 +1100 (EST) Received: (qmail 22927 invoked by alias); 30 Nov 2011 17:58:35 -0000 Received: (qmail 22919 invoked by uid 22791); 30 Nov 2011 17:58:34 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_TM X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 Nov 2011 17:58:20 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pAUHwKes020324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 30 Nov 2011 12:58:20 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pAUHwJPw003957 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 30 Nov 2011 12:58:20 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id pAUHwJHN018418 for ; Wed, 30 Nov 2011 18:58:19 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id pAUHwJws018417 for gcc-patches@gcc.gnu.org; Wed, 30 Nov 2011 18:58:19 +0100 Date: Wed, 30 Nov 2011 18:58:19 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Avoid adding second edge between the same src and dest bb in ehcleanup (PR middle-end/51089) Message-ID: <20111130175819.GM27242@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi! This testcase ICEs starting with the {CLOBBER} additions, because cleanup_empty_eh_merge_phis attempts to redirect an edge to a bb from a bb that already has another edge to that same destination bb. Richard fixed a similar issue last year in one of the cleanup_empty_eh_merge_phis caller's, but this time it happened from the other caller. This patch therefore moves that check into cleanup_empty_eh_merge_phis, so that it handles it right for all callers. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-11-30 Jakub Jelinek PR middle-end/51089 * tree-eh.c (cleanup_empty_eh_merge_phis): Add check to avoid creating duplicate edges here. (cleanup_empty_eh_unsplit): And remove it in the caller. * gfortran.dg/gomp/pr51089.f90: New test. Jakub --- gcc/tree-eh.c.jj 2011-11-29 08:58:52.000000000 +0100 +++ gcc/tree-eh.c 2011-11-30 16:13:32.395352143 +0100 @@ -3653,6 +3653,22 @@ cleanup_empty_eh_merge_phis (basic_block bitmap rename_virts; bitmap ophi_handled; + /* The destination block must not be a regular successor for any + of the preds of the landing pad. Thus, avoid turning + <..> + | \ EH + | <..> + | / + <..> + into + <..> + | | EH + <..> + which CFG verification would choke on. See PR45172 and PR51089. */ + FOR_EACH_EDGE (e, ei, old_bb->preds) + if (find_edge (e->src, new_bb)) + return false; + FOR_EACH_EDGE (e, ei, old_bb->preds) redirect_edge_var_map_clear (e); @@ -3815,8 +3831,6 @@ cleanup_empty_eh_unsplit (basic_block bb { gimple_stmt_iterator gsi; tree lab; - edge_iterator ei; - edge e; /* We really ought not have totally lost everything following a landing pad label. Given that BB is empty, there had better @@ -3839,22 +3853,6 @@ cleanup_empty_eh_unsplit (basic_block bb return false; } - /* The destination block must not be a regular successor for any - of the preds of the landing pad. Thus, avoid turning - <..> - | \ EH - | <..> - | / - <..> - into - <..> - | | EH - <..> - which CFG verification would choke on. See PR45172. */ - FOR_EACH_EDGE (e, ei, bb->preds) - if (find_edge (e->src, e_out->dest)) - return false; - /* Attempt to move the PHIs into the successor block. */ if (cleanup_empty_eh_merge_phis (e_out->dest, bb, e_out, false)) { --- gcc/testsuite/gfortran.dg/gomp/pr51089.f90.jj 2011-11-30 16:18:08.894351965 +0100 +++ gcc/testsuite/gfortran.dg/gomp/pr51089.f90 2011-11-30 16:17:44.000000000 +0100 @@ -0,0 +1,16 @@ +! PR middle-end/51089 +! { dg-do compile } +! { dg-options "-O -fexceptions -fopenmp" } + +subroutine foo + real, allocatable, dimension(:) :: s + real, dimension(:, :, :), pointer :: t + call fn1 (t, s) + call fn2 () +end subroutine foo +subroutine bar + integer :: i +!$omp parallel do + do i = 1, 10 + end do +end subroutine bar