From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69811 invoked by alias); 4 Mar 2015 12:41:32 -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 69768 invoked by uid 89); 4 Mar 2015 12:41:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-oi0-f41.google.com Received: from mail-oi0-f41.google.com (HELO mail-oi0-f41.google.com) (209.85.218.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 04 Mar 2015 12:41:31 +0000 Received: by oigh136 with SMTP id h136so5319699oig.1 for ; Wed, 04 Mar 2015 04:41:29 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.182.29.136 with SMTP id k8mr2877198obh.60.1425472888932; Wed, 04 Mar 2015 04:41:28 -0800 (PST) Received: by 10.76.98.137 with HTTP; Wed, 4 Mar 2015 04:41:28 -0800 (PST) In-Reply-To: <54F697A5.6090908@redhat.com> References: <54F3F648.8090400@redhat.com> <54F697A5.6090908@redhat.com> Date: Wed, 04 Mar 2015 12:41:00 -0000 Message-ID: Subject: Re: [patch/committed] PR middle-end/65233 make walk-ssa_copies handle empty PHIs From: Richard Biener To: Jeff Law Cc: Aldy Hernandez , gcc-patches , Jan Hubicka Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00206.txt.bz2 On Wed, Mar 4, 2015 at 6:27 AM, Jeff Law wrote: > On 03/02/15 01:38, Richard Biener wrote: >> >> On Mon, Mar 2, 2015 at 6:34 AM, Aldy Hernandez wrote: >>> >>> As I mention in the PR... >>> >>> What's happening here is that the ipa_polymorphic_call_context >>> constructor >>> is calling walk_ssa_copies on a PHI node that has no arguments. This >>> happens because finalize_jump_threads eventually removes some PHI >>> arguments >>> as it's redirecting some edges, leaving a PHI with no arguments: >>> >>> SR.33_23 = PHI <> >>> >>> This should get cleaned up later, but the IPA polymorphic code gets >>> called >>> during the actual CFG clean-up, and walk_ssa_copies cannot handle an >>> empty >>> PHI. >>> >>> Approved by Honza. >>> >>> Fully tested on x86-64 Linux and verified that the patch fixes the ICE on >>> an >>> x86-64 Linux cross aarch64-linux-gnu cc1plus. >>> >>> Committed to mainline. >> >> >> I think the real issue is that the walking code is executed via fold_stmt >> when >> called with an API that tells you not to walk SSA use-def chains. > > ? We have something that tells us not to walk the chains? I don't see it > in an API for fold_stmt. How is the ipa-polymorphic code supposed to know > when it can't follow the chains? It gets passed the valueize callback now which returns NULL_TREE for SSA names we can't follow. > The restrictions on what we can do while we're in the inconsistent state > prior to updating the ssa graph aren't defined anywhere and I doubt anyone > really knows what they are. That's obviously concerning. > > We might consider trying to narrow the window in which these inconsistencies > are allowed. To do that I think we need to split cfgcleanup into two > distinct parts. First is unreachable block removal (which is needed so that > we can compute the dominators). Second is everything else. > > The order of operations would be something like > > remove unreachable blocks > ssa graph update > rest of cfg_cleanup > > That just feels too intrusive to try at this stage though. Well, not folding statements from cfg-cleanup would be better. I'll have a look at the testcase in the PR and will come back with a suggestion on what to do for GCC 5. Richard. > > jeff