This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [vtab] Permit coalescing of user variables

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?

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
+Common Report Var(flag_ssa_coalesce_vars,1) Init(1) RejectNegative Optimization
+Permit SSA coalescing of inlined variables only
+Common Report Var(flag_ssa_coalesce_vars,-1) Optimization
+Permit SSA coalescing of all variables
 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
Alexandre Oliva
FSF Latin America Board Member
Red Hat Compiler Engineer   aoliva@{,}
Free Software Evangelist  oliva@{,}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]