From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12290 invoked by alias); 9 Oct 2007 21:32:10 -0000 Received: (qmail 12281 invoked by uid 22791); 9 Oct 2007 21:32:09 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 09 Oct 2007 21:32:06 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.1) with ESMTP id l99LW4Fs018783; Tue, 9 Oct 2007 17:32:04 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l99LW3gI032485; Tue, 9 Oct 2007 17:32:03 -0400 Received: from free.oliva.athome.lsd.ic.unicamp.br (vpn-14-178.rdu.redhat.com [10.11.14.178]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l99LW2qD008732; Tue, 9 Oct 2007 17:32:02 -0400 Received: from free.oliva.athome.lsd.ic.unicamp.br (localhost.localdomain [127.0.0.1]) by free.oliva.athome.lsd.ic.unicamp.br (8.14.1/8.13.8) with ESMTP id l99LVsGw026219; Tue, 9 Oct 2007 18:31:54 -0300 Received: (from aoliva@localhost) by free.oliva.athome.lsd.ic.unicamp.br (8.14.1/8.13.5/Submit) id l99LVqbO026215; Tue, 9 Oct 2007 18:31:52 -0300 To: Andrew MacLeod Cc: gcc-patches@gcc.gnu.org Subject: Re: [vtab] Permit coalescing of user variables References: <4702B1C0.80807@redhat.com> From: Alexandre Oliva Errors-To: aoliva@oliva.athome.lsd.ic.unicamp.br Date: Tue, 09 Oct 2007 21:32:00 -0000 In-Reply-To: (Alexandre Oliva's message of "Tue\, 02 Oct 2007 22\:11\:02 -0300") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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: 2007-10/txt/msg00516.txt.bz2 --=-=-= Content-length: 297 On Oct 2, 2007, Alexandre Oliva wrote: > I guess I could be convinced to introduce yet another command-line > option to control this behavior. How about a tri-state, to permit > coalescing of all variables, of non-inline variables and of none > variables? How about this? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=gcc-ssa-coalesce-vars.patch Content-length: 3576 for gcc/ChangeLog from Alexandre Oliva * common.opt (ftree-coalesce-inlined-vars): New. (ftree-coalesce-vars): New. * doc/invoke.texi: Document them. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Implement them. Index: gcc/common.opt =================================================================== --- gcc/common.opt.orig 2007-10-09 18:02:02.000000000 -0300 +++ gcc/common.opt 2007-10-09 18:27:59.000000000 -0300 @@ -1040,6 +1040,14 @@ ftree-ch Common Report Var(flag_tree_ch) Optimization Enable loop header copying on trees +ftree-coalesce-inlined-vars +Common Report Var(flag_ssa_coalesce_vars,1) Init(1) RejectNegative Optimization +Permit SSA coalescing of inlined variables only + +ftree-coalesce-vars +Common Report Var(flag_ssa_coalesce_vars,-1) Optimization +Permit SSA coalescing of all variables + ftree-copyrename Common Report Var(flag_tree_copyrename) Optimization Replace SSA temporaries with better names in copies Index: gcc/tree-ssa-copyrename.c =================================================================== --- gcc/tree-ssa-copyrename.c.orig 2007-10-09 18:03:34.000000000 -0300 +++ gcc/tree-ssa-copyrename.c 2007-10-09 18:07:30.000000000 -0300 @@ -192,13 +192,13 @@ copy_rename_partition_coalesce (var_map /* Never attempt to coalesce 2 user variables unless one is an inline variable. */ - if (!ign1 && !ign2) + if (!ign1 && !ign2 && flag_ssa_coalesce_vars) { if (DECL_FROM_INLINE (root2)) ign2 = true; else if (DECL_FROM_INLINE (root1)) ign1 = true; - else + else if (flag_ssa_coalesce_vars > 0) { if (debug) fprintf (debug, " : 2 different USER vars. No coalesce.\n"); Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi.orig 2007-10-09 03:30:09.000000000 -0300 +++ gcc/doc/invoke.texi 2007-10-09 18:25:14.000000000 -0300 @@ -359,7 +359,8 @@ Objective-C and Objective-C++ Dialects}. -ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol -ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol -fcheck-data-deps -ftree-parallelize-loops @gol --ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol +-ftree-dominator-opts -ftree-dse -ftree-sink @gol +-ftree-copyrename -ftree-coalesce-inline-vars -ftree-coalesce-vars @gol -ftree-ch -ftree-sra -ftree-ter -ftree-fre -ftree-vectorize @gol -ftree-vect-loop-version -fvect-cost-model -ftree-salias -fipa-pta -fweb @gol -ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol @@ -5804,6 +5805,19 @@ temporaries to other variables at copy l variable names which more closely resemble the original variables. This flag is enabled by default at @option{-O} and higher. +@item -ftree-coalesce-inlined-vars +Permit the copyrename pass to subject inlined variables to coalescing +into other variables. This may harm debug information of such inlined +variables, but it will keep variables of the main function apart from +each other, such that they are more likely to contain the expected +values in a debugging session. + +@item -ftree-coalesce-vars +Permit the copyrename pass to subject all variables to SSA coalescing. +This may severely limit the ability to debug a program. In the negated +form, this flag prevents SSA coalescing of user variables, including +inlined ones. + @item -ftree-ter Perform temporary expression replacement during the SSA->normal phase. Single use/single def temporaries are replaced at their use location with their --=-=-= Content-length: 249 -- Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/ FSF Latin America Board Member http://www.fsfla.org/ Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org} Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org} --=-=-=--