From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3557 invoked by alias); 24 May 2011 15:49:44 -0000 Received: (qmail 3549 invoked by uid 22791); 24 May 2011 15:49:42 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_TM X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 May 2011 15:49:29 +0000 Received: by wye20 with SMTP id 20so6131558wye.20 for ; Tue, 24 May 2011 08:49:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.54.6 with SMTP id o6mr3568080wbg.61.1306252167744; Tue, 24 May 2011 08:49:27 -0700 (PDT) Received: by 10.227.38.129 with HTTP; Tue, 24 May 2011 08:49:27 -0700 (PDT) In-Reply-To: <1306250888.4821.40.camel@L3G5336.ibm.com> References: <1306187637.4821.22.camel@L3G5336.ibm.com> <1306239980.4434.0.camel@gnopaine> <1306244311.4821.31.camel@L3G5336.ibm.com> <1306250888.4821.40.camel@L3G5336.ibm.com> Date: Tue, 24 May 2011 17:26:00 -0000 Message-ID: Subject: Re: [Fwd: Re: [PATCH] Add powi-to-multiply expansion to cse_sincos pass] From: Richard Guenther To: "William J. Schmidt" Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2011-05/txt/msg01738.txt.bz2 On Tue, May 24, 2011 at 5:28 PM, William J. Schmidt wrote: > > On Tue, 2011-05-24 at 16:44 +0200, Richard Guenther wrote: >> On Tue, May 24, 2011 at 3:38 PM, William J. Schmidt >> wrote: >> > >> > On Tue, 2011-05-24 at 15:11 +0200, Richard Guenther wrote: >> >> On Tue, May 24, 2011 at 2:26 PM, William J. Schmidt >> >> wrote: >> >> > Sure, I'll give that a try this morning. =A0Much obliged. >> >> >> >> Seems it won't work that way without some major changes elsewhere. >> >> Instead follow what update_call_from_tree () does before calling >> >> gsi_replace. >> > >> > Bother. =A0This won't work, unfortunately. =A0I can't use gimple_set_v= use () >> > and gimple_set_vdef () on statements without memory ops. >> >> You should do >> >> =A0 if (!gimple_has_mem_ops (new_stmt)) >> =A0 =A0 unlink_stmt_vdef (old_stmt); > > OK, thanks, that's the interface I was struggling to find. > > That solved the issue I ran into. =A0The handling for powi now looks like > this: > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0CASE_FLT_FN (BUILT_IN_POWI): > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0arg0 =3D gimple_call_arg (stmt, 0); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0arg1 =3D gimple_call_arg (stmt, 1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (!host_integerp (arg1, 0)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0n =3D TREE_INT_CST_LOW (arg1); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0loc =3D gimple_location (stmt); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0result =3D gimple_expand_builtin_powi = (&gsi, loc, arg0, n); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (result) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tree lhs =3D gimple_get_lhs (s= tmt); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0gimple new_stmt =3D gimple_bui= ld_assign (lhs, result); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0gimple_set_location (new_stmt,= loc); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0move_ssa_defining_stmt_for_def= s (new_stmt, stmt); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (gimple_vdef (stmt)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0gcc_assert (!gimple_ha= s_mem_ops (new_stmt)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0unlink_stmt_vdef (stmt= ); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} As you say the new stmt will not have mem-ops, so move_ssa_defining_stmt_for_defs is not necessary. Likewise you can simply unconditionally call unlink_stmt_vdef. > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0gsi_replace (&gsi, new_stmt, t= rue); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break; > > gimple_has_mem_ops (new_stmt) will always return false. =A0The assert is > in place in case we add other powi transforms in the future. > > The call to move_ssa_defining_stmt_for_defs requires adding the header > file tree-ssa-propagate.h, and the corresponding dependency in > Makefile.in. > > Currently regression testing the "final" fix. =A0Let me know if you want > to see it one more time before commit. It's ok with the above two changes. Thanks, Richard. > Thanks as always for your help! > > Bill > >> >> > Bill >> > >> >> >> >> Richard. >> >> >> > >> > >> > > >