From patchwork Wed Jun 30 13:25:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Matz X-Patchwork-Id: 57411 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 067441007D1 for ; Wed, 30 Jun 2010 23:25:59 +1000 (EST) Received: (qmail 27820 invoked by alias); 30 Jun 2010 13:25:52 -0000 Received: (qmail 27789 invoked by uid 22791); 30 Jun 2010 13:25:51 -0000 X-SWARE-Spam-Status: No, hits=-5.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 Jun 2010 13:25:45 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 8EEF093987; Wed, 30 Jun 2010 15:25:42 +0200 (CEST) Date: Wed, 30 Jun 2010 15:25:41 +0200 (CEST) From: Michael Matz To: Richard Guenther Cc: gcc-patches@gcc.gnu.org Subject: Re: [rfa] Fix PR44699: bootstrap problem In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, On Tue, 29 Jun 2010, Richard Guenther wrote: > On Tue, Jun 29, 2010 at 5:45 PM, Michael Matz wrote: > > Hello, > > > > Allocating an array of length num_ssa_names, then doing foldings or other > > transformations that can create new SSA names, and then iterating that > > array again as if it had num_ssa_names elements is not a good idea. > > > > This fixes the testcase.  I'm going to regstrap this, once the > > function_arg_advance brokenness is fixed.  Okay, assuming this will work? > > Ok. While it fixes the testcase (and regstraps on linux) it still breaks on Darwin. We also need to be careful to not attach VDEFs to the generated new 'lhs = tmp' assignment if LHS is a gimple reg. Those VDEFs would be removed fairly quickly breaking the vdef/vuse chains again (that was pre-existing breakage). So I'd like to add this hunk to the patch (whole patch regstrapping again on x86_64-linux). Okay for trunk? Ciao, Michael. Index: gimple-fold.c =================================================================== --- gimple-fold.c (revision 161602) +++ gimple-fold.c (working copy) @@ -1150,7 +1150,14 @@ gimplify_and_update_call_from_tree (gimp gsi_insert_before (si_p, last, GSI_NEW_STMT); gsi_next (si_p); } - if (laststore) + if (laststore && is_gimple_reg (lhs)) + { + gimple_set_vdef (laststore, gimple_vdef (stmt)); + update_stmt (laststore); + move_ssa_defining_stmt_for_defs (laststore, stmt); + laststore = NULL; + } + else if (laststore) { reaching_vuse = make_ssa_name (gimple_vop (cfun), laststore); gimple_set_vdef (laststore, reaching_vuse); @@ -1158,9 +1165,13 @@ gimplify_and_update_call_from_tree (gimp laststore = NULL; } new_stmt = gimple_build_assign (lhs, tmp); - gimple_set_vuse (new_stmt, reaching_vuse); - gimple_set_vdef (new_stmt, gimple_vdef (stmt)); - move_ssa_defining_stmt_for_defs (new_stmt, stmt); + if (!is_gimple_reg (tmp)) + gimple_set_vuse (new_stmt, reaching_vuse); + if (!is_gimple_reg (lhs)) + { + gimple_set_vdef (new_stmt, gimple_vdef (stmt)); + move_ssa_defining_stmt_for_defs (new_stmt, stmt); + } } gimple_set_location (new_stmt, gimple_location (stmt));