diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 684361f1177..6969253b257 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2012-06-13 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. + 2012-06-13 Richard Sandiford * read-rtl.c (mapping): Remove index field. Add current_value field. diff --git a/gcc/common.opt b/gcc/common.opt index 02c7cd3ee7a..5b1b4d8eea3 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1944,6 +1944,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(2) RejectNegative Optimization +Enable coalescing of copy-related user variables that are inlined + +ftree-coalesce-vars +Common Report Var(flag_ssa_coalesce_vars,2) Optimization +Enable coalescing of all copy-related user variables + ftree-copyrename Common Report Var(flag_tree_copyrename) Optimization Replace SSA temporaries with better names in copies diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 2bb870a5edd..621ef29f8de 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -405,7 +405,8 @@ Objective-C and Objective-C++ Dialects}. -fsplit-ivs-in-unroller -fsplit-wide-types -fstack-protector @gol -fstack-protector-all -fstrict-aliasing -fstrict-overflow @gol -fthread-jumps -ftracer -ftree-bit-ccp @gol --ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol +-ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol +-ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol -ftree-loop-if-convert-stores -ftree-loop-im @gol @@ -7490,6 +7491,24 @@ temporaries to other variables at copy locations, usually resulting in 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 +Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to +combine small user-defined variables too, but only if they were inlined +from other functions. It is a more limited form of +@option{-ftree-coalesce-vars}. This may harm debug information of such +inlined variables, but it will keep variables of the inlined-into +function apart from each other, such that they are more likely to +contain the expected values in a debugging session. This was the +default in GCC versions older than 4.7. + +@item -ftree-coalesce-vars +Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to +combine small user-defined variables too, instead of just compiler +temporaries. This may severely limit the ability to debug an optimized +program compiled with @option{-fno-var-tracking-assignments}. In the +negated form, this flag prevents SSA coalescing of user variables, +including inlined ones. This option is enabled by default. + @item -ftree-ter @opindex ftree-ter Perform temporary expression replacement during the SSA->normal phase. Single diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a8384ffc4ab..8e6000d1b26 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-06-13 Alexandre Oliva + + * g++.dg/tree-ssa/ivopts-2.C: Adjust for coalescing. + * gcc.dg/tree-ssa/forwprop-11.c: Likewise. + * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. + 2012-06-13 Tobias Burnus PR fortran/53643 diff --git a/gcc/testsuite/g++.dg/tree-ssa/ivopts-2.C b/gcc/testsuite/g++.dg/tree-ssa/ivopts-2.C index 908299d98e8..83b5728ef1a 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/ivopts-2.C +++ b/gcc/testsuite/g++.dg/tree-ssa/ivopts-2.C @@ -7,5 +7,5 @@ void test (int *b, int *e, int stride) *p = 1; } -/* { dg-final { scan-tree-dump-times "PHI