From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100466 invoked by alias); 28 Mar 2017 07:45:42 -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 90498 invoked by uid 89); 28 Mar 2017 07:45:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1894 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Mar 2017 07:45:33 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 29E67AC2C; Tue, 28 Mar 2017 07:45:31 +0000 (UTC) Subject: Re: [PATCH] Handle PHI nodes w/o a argument (PR ipa/80205). To: Richard Biener References: Cc: GCC Patches , Jan Hubicka From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Message-ID: Date: Tue, 28 Mar 2017 07:52:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg01425.txt.bz2 On 03/27/2017 04:27 PM, Richard Biener wrote: > On Mon, Mar 27, 2017 at 4:14 PM, Richard Biener > wrote: >> On Mon, Mar 27, 2017 at 2:47 PM, Martin Liška wrote: >>> Hello. >>> >>> As described in the PR, we can create a PHI node in einline that has no argument. >>> That can cause ICE in devirtualization and should be thus handled. >>> >>> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. >>> >>> Ready to be installed? >> >> We shouldn't ever have a PHI w/o argument. > > ;; basic block 14, loop depth 0 > ;; pred: > # SR.2_19 = PHI <> > [0.00%]: > a::~a (&g); > resx 12 > ;; succ: 17 > > the CFG has not been cleaned up here (this block is unreachable). > > Hmm, I see we are called from fold_stmt. I suppose we process > statements_to_fold before removing unreachable blocks to not > walk over dead stmts... chicken-and-egg... > > Still not creating that PHI should be possible. I see, thanks for help. Patch fixes the issue, may I install it after regression tested? Thanks, Martin > > Index: gcc/tree-inline.c > =================================================================== > --- gcc/tree-inline.c (revision 246500) > +++ gcc/tree-inline.c (working copy) > @@ -2344,6 +2344,13 @@ copy_phis_for_bb (basic_block bb, copy_b > if (!virtual_operand_p (res)) > { > walk_tree (&new_res, copy_tree_body_r, id, NULL); > + if (EDGE_COUNT (new_bb->preds) == 0) > + { > + /* Technically we'd want a SSA_DEFAULT_DEF here... */ > + SSA_NAME_DEF_STMT (new_res) = gimple_build_nop (); > + } > + else > + { > new_phi = create_phi_node (new_res, new_bb); > FOR_EACH_EDGE (new_edge, ei, new_bb->preds) > { > @@ -2389,6 +2396,7 @@ copy_phis_for_bb (basic_block bb, copy_b > > add_phi_arg (new_phi, new_arg, new_edge, locus); > } > + } > } > } > > > >>> Martin