From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5280 invoked by alias); 24 May 2011 15:28:39 -0000 Received: (qmail 5267 invoked by uid 22791); 24 May 2011 15:28:38 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,MAY_BE_FORGED,TW_TM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e39.co.us.ibm.com (HELO e39.co.us.ibm.com) (32.97.110.160) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 May 2011 15:28:24 +0000 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e39.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p4OFEM6t021122 for ; Tue, 24 May 2011 09:14:22 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p4OFSAYm190052 for ; Tue, 24 May 2011 09:28:10 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p4O9RgTf031364 for ; Tue, 24 May 2011 03:27:42 -0600 Received: from [9.10.86.209] (tepot-pc.rchland.ibm.com [9.10.86.209] (may be forged)) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p4O9Rgjk031302; Tue, 24 May 2011 03:27:42 -0600 Subject: Re: [Fwd: Re: [PATCH] Add powi-to-multiply expansion to cse_sincos pass] From: "William J. Schmidt" To: Richard Guenther Cc: gcc-patches@gcc.gnu.org In-Reply-To: References: <1306187637.4821.22.camel@L3G5336.ibm.com> <1306239980.4434.0.camel@gnopaine> <1306244311.4821.31.camel@L3G5336.ibm.com> Content-Type: text/plain Date: Tue, 24 May 2011 17:06:00 -0000 Message-Id: <1306250888.4821.40.camel@L3G5336.ibm.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit 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/msg01735.txt.bz2 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. Much 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. This won't work, unfortunately. I can't use gimple_set_vuse () > > and gimple_set_vdef () on statements without memory ops. > > You should do > > if (!gimple_has_mem_ops (new_stmt)) > unlink_stmt_vdef (old_stmt); OK, thanks, that's the interface I was struggling to find. That solved the issue I ran into. The handling for powi now looks like this: CASE_FLT_FN (BUILT_IN_POWI): arg0 = gimple_call_arg (stmt, 0); arg1 = gimple_call_arg (stmt, 1); if (!host_integerp (arg1, 0)) break; n = TREE_INT_CST_LOW (arg1); loc = gimple_location (stmt); result = gimple_expand_builtin_powi (&gsi, loc, arg0, n); if (result) { tree lhs = gimple_get_lhs (stmt); gimple new_stmt = gimple_build_assign (lhs, result); gimple_set_location (new_stmt, loc); move_ssa_defining_stmt_for_defs (new_stmt, stmt); if (gimple_vdef (stmt)) { gcc_assert (!gimple_has_mem_ops (new_stmt)); unlink_stmt_vdef (stmt); } gsi_replace (&gsi, new_stmt, true); } break; gimple_has_mem_ops (new_stmt) will always return false. The 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. Let me know if you want to see it one more time before commit. Thanks as always for your help! Bill > > > Bill > > > >> > >> Richard. > >> > > > > > >