https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85614

Daniel Le Duc Khoi Nguyen <greenrecyclebin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greenrecyclebin at gmail dot 
com

--- Comment #1 from Daniel Le Duc Khoi Nguyen <greenrecyclebin at gmail dot 
com> ---
(In reply to krblock from comment #0)
> In the -fdump-tree option a "switch" is specified to select when you want
> the dump. To determine the "switch", it suggests "-fdump-passes" be used.
> However, this does not list "original" which is also a possible choice. This
> should be explicitly listed in the documentation. Not sure if there are
> other not listed "switches". Also the term "switch" is odd. "pass" might be
> a more intuitive name.

I noticed the same thing too. In other words, some options are no longer
discoverable after the changes in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32003#c8.

The below code lists the options that were previously documented but have since
become no longer discoverable:

$ g++ --version | head -n 1
g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

$ ruby --version | head -n 1
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]

$ touch a.cpp
$ cat <<'EOF' > tree-passes-presence-in-fdump-passes-output.rb
> all_passes = `g++ -S -fdump-passes -o /dev/null a.cpp 2>&1 > /dev/null`
> 
> tree_passes =
>   %w(split-paths original optimized gimple cfg ch ssa alias ccp storeccp pre 
> fre
>      copyprop store_copyprop dce sra sink dom dse phiopt backprop forwprop 
> nrv vect
>      slp vrp evrp oaccdevlow all)
> 
> tree_passes.each do |pass|
>   tree_pass = "tree-#{pass}"
> 
>   i = all_passes.index(tree_pass)
> 
>   print "#{tree_pass}: "
> 
>   if i
>     next_char = all_passes[i + tree_pass.size]
> 
>     if next_char.match?('\d')
>       puts 'prefix match (followed by a digit).'
>     elsif next_char == ' '
>       puts 'exact match.'
>     else
>       puts 'prefix match.'
>     end
>   else
>     puts 'no match.'
>   end
> end
> EOF

$ ruby tree-passes-presence-in-fdump-passes-output.rb | ag -F 'no match'
tree-original: no match.
tree-gimple: no match.
tree-storeccp: no match.
tree-store_copyprop: no match.
tree-all: no match.

$ for i in $(!!); do \
>         if g++ -fdump-"$i" -S -o /dev/null a.cpp; then \
>                 echo "$i: works."; \
>         else \
>                 echo "$i: fails."; \
>         fi \
> done
tree-original: works.
tree-gimple: works.
cc1plus: error: unrecognized command line option ‘-fdump-tree-storeccp’
tree-storeccp: fails.
cc1plus: error: unrecognized command line option ‘-fdump-tree-store_copyprop’
tree-store_copyprop: fails.
tree-all: works.

Improvements:
  1. Change "switch" to "pass" to be more accurate

  2. Make default passes, e.g., tree-original (is this considered a pass?),
tree-gimple and tree-all (already documented) discoverable by:
    2.1. Adding them in -fdump-passes output
    2.2. Or documenting them explicitly
    2.3. Or some other options?

I prefer 2.1. since it improves things in the direction set out in the previous
changes. Let me know your thoughts and I will consider submitting a patch.
Thank you.

Reply via email to