This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Add options for PTA, tree forwprop and phiprop
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 13 May 2009 14:23:49 +0200 (CEST)
- Subject: [PATCH] Add options for PTA, tree forwprop and phiprop
This adds optimization flags for these three passes. I have been
locally patching my tree to disable these in numerous cases for
tracking down bugs and for rubustness testing of later passes.
Bootstrapped and tested on x86_64-unknown-linux-gnu - any objections
with adding new flags?
Thanks,
Richard.
2009-05-13 Richard Guenther <rguenther@suse.de>
* common.opt (-ftree-forwprop, -ftree-phiprop, -ftree-pta):
New options, enabled by default.
* doc/invoke.texi (-ftree-forwprop, -ftree-phiprop, -ftree-pta):
Document.
* tree-ssa-forwprop.c (gate_forwprop): Use flag_tree_forwprop.
* tree-ssa-phiprop.c (gate_phiprop): Use flag_tree_phiprop.
* tree-ssa-structalias.c (gate_tree_pta): New function.
(pass_build_alias): Use it.
Index: trunk/gcc/common.opt
===================================================================
*** trunk.orig/gcc/common.opt 2009-05-04 11:09:18.000000000 +0200
--- trunk/gcc/common.opt 2009-05-12 17:32:07.000000000 +0200
*************** ftree-dse
*** 1202,1207 ****
--- 1202,1211 ----
Common Report Var(flag_tree_dse) Optimization
Enable dead store elimination
+ ftree-forwprop
+ Common Report Var(flag_tree_forwprop) Init(1) Optimization
+ Enable forward propagation on trees
+
ftree-fre
Common Report Var(flag_tree_fre) Optimization
Enable Full Redundancy Elimination (FRE) on trees
*************** ftree-parallelize-loops=
*** 1230,1239 ****
--- 1234,1251 ----
Common Report Joined UInteger Var(flag_tree_parallelize_loops) Init(1)
Enable automatic parallelization of loops
+ ftree-phiprop
+ Common Report Var(flag_tree_phiprop) Init(1) Optimization
+ Enable hoisting loads from conditional pointers.
+
ftree-pre
Common Report Var(flag_tree_pre) Optimization
Enable SSA-PRE optimization on trees
+ ftree-pta
+ Common Report Var(flag_tree_pta) Init(1) Optimization
+ Perform function-local points-to analysis on trees.
+
ftree-reassoc
Common Report Var(flag_tree_reassoc) Init(1) Optimization
Enable reassociation on tree level
Index: trunk/gcc/doc/invoke.texi
===================================================================
*** trunk.orig/gcc/doc/invoke.texi 2009-05-12 12:48:25.000000000 +0200
--- trunk/gcc/doc/invoke.texi 2009-05-12 17:45:25.000000000 +0200
*************** Objective-C and Objective-C++ Dialects}.
*** 290,301 ****
--- 290,303 ----
-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
+ -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
-fdump-tree-nrv -fdump-tree-vect @gol
-fdump-tree-sink @gol
-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
+ -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
-ftree-vectorizer-verbose=@var{n} @gol
*************** Objective-C and Objective-C++ Dialects}.
*** 368,377 ****
-fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
-ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
-ftree-copyrename -ftree-dce @gol
! -ftree-dominator-opts -ftree-dse -ftree-fre -ftree-loop-im @gol
! -ftree-loop-distribution @gol
-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
! -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-reassoc @gol
-ftree-sink -ftree-sra -ftree-switch-conversion @gol
-ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
-funit-at-a-time -funroll-all-loops -funroll-loops @gol
--- 370,379 ----
-fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
-ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
-ftree-copyrename -ftree-dce @gol
! -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-im @gol
! -ftree-phiprop -ftree-loop-distribution @gol
-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
! -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
-ftree-sink -ftree-sra -ftree-switch-conversion @gol
-ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
-funit-at-a-time -funroll-all-loops -funroll-loops @gol
*************** compilation time.
*** 5448,5455 ****
--- 5450,5460 ----
-ftree-dce @gol
-ftree-dominator-opts @gol
-ftree-dse @gol
+ -ftree-forwprop @gol
-ftree-fre @gol
+ -ftree-phiprop @gol
-ftree-sra @gol
+ -ftree-pta @gol
-ftree-ter @gol
-funit-at-a-time}
*************** at @option{-O} and higher.
*** 6162,6167 ****
--- 6167,6177 ----
Perform partial redundancy elimination (PRE) on trees. This flag is
enabled by default at @option{-O2} and @option{-O3}.
+ @item -ftree-forwprop
+ @opindex ftree-forwprop
+ Perform forward propagation on trees. This flag is enabled by default
+ at @option{-O} and higher.
+
@item -ftree-fre
@opindex ftree-fre
Perform full redundancy elimination (FRE) on trees. The difference
*************** that are computed on all paths leading t
*** 6170,6175 ****
--- 6180,6190 ----
This analysis is faster than PRE, though it exposes fewer redundancies.
This flag is enabled by default at @option{-O} and higher.
+ @item -ftree-phiprop
+ @opindex ftree-phiprop
+ Perform hoisting of loads from conditional pointers on trees. This
+ pass is enabled by default at @option{-O} and higher.
+
@item -ftree-copy-prop
@opindex ftree-copy-prop
Perform copy propagation on trees. This pass eliminates unnecessary
*************** rather than constrained e.g.@: by memory
*** 6436,6441 ****
--- 6451,6461 ----
implies @option{-pthread}, and thus is only supported on targets
that have support for @option{-pthread}.
+ @item -ftree-pta
+ @opindex ftree-pta
+ Perform function-local points-to analysis on trees. This flag is
+ enabled by default at @option{-O} and higher.
+
@item -ftree-sra
@opindex ftree-sra
Perform scalar replacement of aggregates. This pass replaces structure
Index: trunk/gcc/tree-ssa-forwprop.c
===================================================================
*** trunk.orig/gcc/tree-ssa-forwprop.c 2009-05-04 13:00:33.000000000 +0200
--- trunk/gcc/tree-ssa-forwprop.c 2009-05-12 17:26:14.000000000 +0200
*************** tree_ssa_forward_propagate_single_use_va
*** 1342,1348 ****
static bool
gate_forwprop (void)
{
! return 1;
}
struct gimple_opt_pass pass_forwprop =
--- 1342,1348 ----
static bool
gate_forwprop (void)
{
! return flag_tree_forwprop;
}
struct gimple_opt_pass pass_forwprop =
Index: trunk/gcc/tree-ssa-structalias.c
===================================================================
*** trunk.orig/gcc/tree-ssa-structalias.c 2009-05-12 12:48:15.000000000 +0200
--- trunk/gcc/tree-ssa-structalias.c 2009-05-12 17:26:53.000000000 +0200
*************** compute_may_aliases (void)
*** 5737,5742 ****
--- 5737,5747 ----
return 0;
}
+ static bool
+ gate_tree_pta (void)
+ {
+ return flag_tree_pta;
+ }
/* A dummy pass to cause points-to information to be computed via
TODO_rebuild_alias. */
*************** struct gimple_opt_pass pass_build_alias
*** 5746,5752 ****
{
GIMPLE_PASS,
"alias", /* name */
! NULL, /* gate */
NULL, /* execute */
NULL, /* sub */
NULL, /* next */
--- 5751,5757 ----
{
GIMPLE_PASS,
"alias", /* name */
! gate_tree_pta, /* gate */
NULL, /* execute */
NULL, /* sub */
NULL, /* next */
Index: trunk/gcc/tree-ssa-phiprop.c
===================================================================
*** trunk.orig/gcc/tree-ssa-phiprop.c 2009-05-05 16:45:54.000000000 +0200
--- trunk/gcc/tree-ssa-phiprop.c 2009-05-12 17:32:22.000000000 +0200
*************** tree_ssa_phiprop (void)
*** 381,387 ****
static bool
gate_phiprop (void)
{
! return 1;
}
struct gimple_opt_pass pass_phiprop =
--- 381,387 ----
static bool
gate_phiprop (void)
{
! return flag_tree_phiprop;
}
struct gimple_opt_pass pass_phiprop =