From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67676 invoked by alias); 28 Mar 2017 08:12:53 -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 67645 invoked by uid 89); 28 Mar 2017 08:12:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2343, H*i:sk:d40534c, H*f:sk:d40534c X-HELO: mail-oi0-f43.google.com Received: from mail-oi0-f43.google.com (HELO mail-oi0-f43.google.com) (209.85.218.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Mar 2017 08:12:51 +0000 Received: by mail-oi0-f43.google.com with SMTP id b187so1443219oif.0 for ; Tue, 28 Mar 2017 01:12:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=LGBIf0oKzfEr1ASLbdOKCZNQsu2chVDRc8qLOLk/CGc=; b=UfEu3lburNDDRDvfjaQ1SPIPFVp0rREDNuHQxaeP+hPt+OpTQ8TCcF4jCnHTnjBJqE QyEmaPxKgQj0g0c8ccN8un84bBm1ueIDY+jEz/kg829PpuQZb67QsW4gAZGcXvp1AFHM wjx44QBI3U5DfGo6+djm31ZBLAxF4l8KZ1bCuJLgJgwzipINAEObEDctkLg8Un5i8W/n 0PSUakaCK+npRbfRmsoMz8fViseMy7DWFiVS/vUoONqSbCx0e25JYGxNhUhrOs8hrATv 5cXhXA/oUWv9TjDvGEiw9jq6rjxWOtoUzupvpvTySuWbUFuVvM06RWLisDbKqIzdHvBe TQOQ== X-Gm-Message-State: AFeK/H1TV8cNEwFuGCp4g5gI8DrAsQARccP9c5RM2tnEczkjV9YgP0+S5AXA08NbdR7iRu3JUyboNBlFhI3A+A== X-Received: by 10.202.91.132 with SMTP id p126mr3280772oib.196.1490688771399; Tue, 28 Mar 2017 01:12:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.83.4 with HTTP; Tue, 28 Mar 2017 01:12:51 -0700 (PDT) In-Reply-To: References: From: Richard Biener Date: Tue, 28 Mar 2017 08:23:00 -0000 Message-ID: Subject: Re: [PATCH] Handle PHI nodes w/o a argument (PR ipa/80205). To: =?UTF-8?Q?Martin_Li=C5=A1ka?= Cc: GCC Patches , Jan Hubicka Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg01430.txt.bz2 On Tue, Mar 28, 2017 at 9:45 AM, Martin Li=C5=A1ka wrote: > 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=C5=A1ka wro= te: >>>> Hello. >>>> >>>> As described in the PR, we can create a PHI node in einline that has n= o argument. >>>> That can cause ICE in devirtualization and should be thus handled. >>>> >>>> Patch can bootstrap on ppc64le-redhat-linux and survives regression te= sts. >>>> >>>> Ready to be installed? >>> >>> We shouldn't ever have a PHI w/o argument. >> >> ;; basic block 14, loop depth 0 >> ;; pred: >> # SR.2_19 =3D 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? I think it's progression, still not 100% safe as we have a SSA name with a GIMPLE_NOP definition that is not in any BB and the SSA name is not a default def. But yes, I've written a comment to that effect ;) Thus ok. An improvement would be to not copy unreachable regions at all... Thanks, Richard. > Thanks, > Martin > >> >> Index: gcc/tree-inline.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- 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) =3D=3D 0) >> + { >> + /* Technically we'd want a SSA_DEFAULT_DEF here... */ >> + SSA_NAME_DEF_STMT (new_res) =3D gimple_build_nop (); >> + } >> + else >> + { >> new_phi =3D 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 >