On Mon, 25 Mar 2024, Chenghui Pan wrote: > Current document of Tree SSA passes contains many parts that is not > updated for many years. > > This patch removes some info that is outdated and not existed in > current GCC codebase, and fixes some wrong code location descriptions > based on current codebase status and ChangeLogs. > > gcc/ChangeLog: > > * doc/passes.texi: Correction of Tree SSA Passes info. > --- > gcc/doc/passes.texi | 70 ++++----------------------------------------- > 1 file changed, 6 insertions(+), 64 deletions(-) > > diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi > index b50d3d5635b..068036acb7d 100644 > --- a/gcc/doc/passes.texi > +++ b/gcc/doc/passes.texi > @@ -450,17 +450,6 @@ The following briefly describes the Tree optimization > passes that are > run after gimplification and what source files they are located in. > > @itemize @bullet > -@item Remove useless statements > - > -This pass is an extremely simple sweep across the gimple code in which > -we identify obviously dead code and remove it. Here we do things like > -simplify @code{if} statements with constant conditions, remove > -exception handling constructs surrounding code that obviously cannot > -throw, remove lexical bindings that contain no variables, and other > -assorted simplistic cleanups. The idea is to get rid of the obvious > -stuff quickly rather than wait until later when it's more work to get > -rid of it. This pass is located in @file{tree-cfg.cc} and described by > -@code{pass_remove_useless_stmts}. > > @item OpenMP lowering > > @@ -478,7 +467,7 @@ described by @code{pass_lower_omp}. > > If OpenMP generation (@option{-fopenmp}) is enabled, this pass expands > parallel regions into their own functions to be invoked by the thread > -library. The pass is located in @file{omp-low.cc} and is described by > +library. The pass is located in @file{omp-expand.cc} and is described by > @code{pass_expand_omp}. > > @item Lower control flow > @@ -511,15 +500,6 @@ This pass decomposes a function into basic blocks and > creates all of > the edges that connect them. It is located in @file{tree-cfg.cc} and > is described by @code{pass_build_cfg}. > > -@item Find all referenced variables > - > -This pass walks the entire function and collects an array of all > -variables referenced in the function, @code{referenced_vars}. The > -index at which a variable is found in the array is used as a UID > -for the variable within this function. This data is needed by the > -SSA rewriting routines. The pass is located in @file{tree-dfa.cc} > -and is described by @code{pass_referenced_vars}. > - > @item Enter static single assignment form > > This pass rewrites the function such that it is in SSA form. After > @@ -562,15 +542,6 @@ variables that are used once into the expression that > uses them and > seeing if the result can be simplified. It is located in > @file{tree-ssa-forwprop.cc} and is described by @code{pass_forwprop}. > > -@item Copy Renaming > - > -This pass attempts to change the name of compiler temporaries involved in > -copy operations such that SSA->normal can coalesce the copy away. When > compiler > -temporaries are copies of user variables, it also renames the compiler > -temporary to the user variable resulting in better use of user symbols. It > is > -located in @file{tree-ssa-copyrename.c} and is described by > -@code{pass_copyrename}. > - > @item PHI node optimizations > > This pass recognizes forms of PHI inputs that can be represented as > @@ -585,8 +556,7 @@ The resulting may-alias, must-alias, and escape analysis > information > is used to promote variables from in-memory addressable objects to > non-aliased variables that can be renamed into SSA form. We also > update the @code{VDEF}/@code{VUSE} memory tags for non-renameable > -aggregates so that we get fewer false kills. The pass is located > -in @file{tree-ssa-alias.cc} and is described by @code{pass_may_alias}. > +aggregates so that we get fewer false kills.
This pass is now located in tree-ssa-structalias.cc and it's named pass_build_alias instead. The part of the description that says "The resulting may-alias, must-alias, and escape analysis information is used to promote variables from in-memory addressable objects to non-aliased variables that can be renamed into SSA form. We also update the @code{VDEF}/@code{VUSE} memory tags for non-renameable aggregates so that we get fewer false kills." is obsolete and should be removed. The rest of the changes look good to me. Thanks, Richard. > Interprocedural points-to information is located in > @file{tree-ssa-structalias.cc} and described by @code{pass_ipa_pta}. > @@ -604,7 +574,7 @@ is described by @code{pass_ipa_tree_profile}. > This pass implements series of heuristics to guess propababilities > of branches. The resulting predictions are turned into edge profile > by propagating branches across the control flow graphs. > -The pass is located in @file{tree-profile.cc} and is described by > +The pass is located in @file{predict.cc} and is described by > @code{pass_profile}. > > @item Lower complex arithmetic > @@ -653,7 +623,7 @@ in @file{tree-ssa-math-opts.cc} and is described by > @item Full redundancy elimination > > This is a simpler form of PRE that only eliminates redundancies that > -occur on all paths. It is located in @file{tree-ssa-pre.cc} and > +occur on all paths. It is located in @file{tree-ssa-sccvn.cc} and > described by @code{pass_fre}. > > @item Loop optimization > @@ -708,7 +678,7 @@ to align the number of iterations, and to align the > memory accesses in the > loop. > The pass is implemented in @file{tree-vectorizer.cc} (the main driver), > @file{tree-vect-loop.cc} and @file{tree-vect-loop-manip.cc} (loop specific > parts > -and general loop utilities), @file{tree-vect-slp} (loop-aware SLP > +and general loop utilities), @file{tree-vect-slp.cc} (loop-aware SLP > functionality), @file{tree-vect-stmts.cc}, @file{tree-vect-data-refs.cc} and > @file{tree-vect-slp-patterns.cc} containing the SLP pattern matcher. > Analysis of data references is in @file{tree-data-ref.cc}. > @@ -755,10 +725,6 @@ the ``copy-of'' relation. It eliminates redundant > copies from the > code. The pass is located in @file{tree-ssa-copy.cc} and described by > @code{pass_copy_prop}. > > -A related pass that works on memory copies, and not just register > -copies, is located in @file{tree-ssa-copy.cc} and described by > -@code{pass_store_copy_prop}. > - > @item Value range propagation > > This transformation is similar to constant propagation but > @@ -811,14 +777,6 @@ run last so that we have as much time as possible to > prove that the > statement is not reachable. It is located in @file{tree-cfg.cc} and > is described by @code{pass_warn_function_return}. > > -@item Leave static single assignment form > - > -This pass rewrites the function such that it is in normal form. At > -the same time, we eliminate as many single-use temporaries as possible, > -so the intermediate language is no longer GIMPLE, but GENERIC@. The > -pass is located in @file{tree-outof-ssa.cc} and is described by > -@code{pass_del_ssa}. > - > @item Merge PHI nodes that feed into one another > > This is part of the CFG cleanup passes. It attempts to join PHI nodes > @@ -857,25 +815,9 @@ pass is located in @file{tree-object-size.cc} and is > described by > @item Loop invariant motion > > This pass removes expensive loop-invariant computations out of loops. > -The pass is located in @file{tree-ssa-loop.cc} and described by > +The pass is located in @file{tree-ssa-loop-im.cc} and described by > @code{pass_lim}. > > -@item Loop nest optimizations > - > -This is a family of loop transformations that works on loop nests. It > -includes loop interchange, scaling, skewing and reversal and they are > -all geared to the optimization of data locality in array traversals > -and the removal of dependencies that hamper optimizations such as loop > -parallelization and vectorization. The pass is located in > -@file{tree-loop-linear.c} and described by > -@code{pass_linear_transform}. > - > -@item Removal of empty loops > - > -This pass removes loops with no code in them. The pass is located in > -@file{tree-ssa-loop-ivcanon.cc} and described by > -@code{pass_empty_loop}. > - > @item Unrolling of small loops > > This pass completely unrolls loops with few iterations. The pass >