On 11/25/20 2:48 PM, Richard Biener wrote:
On Mon, Nov 23, 2020 at 2:02 PM Martin Liška <mli...@suse.cz> wrote:
On 11/23/20 12:00 PM, Richard Biener wrote:
Can you split out the unifying of -[gf]record-gcc-switches processing
and the target hook adjustment from the change introducing
-frecord-gcc-switches-format?
Sure.
dwarf2out.c seems to retain its gen_producer_string () even though
you duplicate it elsewhere and it is now unused? Please retain
the gen_producer_string name since the function does actual
processing and not just fetch a precomputed string from somewhere.
Yep, please take a look at the attached patch.
I'd like somebody else chime in on the -frecord-gcc-switches-format
driver handling but will happily work with getting the unification part merged.
May I apply the patch after it finishes regression tests and bootstrap?
@@ -1523,8 +1378,9 @@ process_options (void)
if (version_flag)
{
print_version (stderr, "", true);
- if (! quiet_flag)
- print_switch_values (print_to_stderr);
+ if (!quiet_flag)
+ fputs (gen_producer_string (lang_hooks.name, save_decoded_options,
+ save_decoded_options_count), stderr);
}
so I wonder whether this regresses (no newlines anymore, no separate
printing of options passed/enabled). Previously with -Q -v you'll get sth
like
options passed: -v
-iprefix
/home/rguenther/obj-gcc2-g/gcc/../lib64/gcc/x86_64-pc-linux-gnu/11.0.0/
-isystem ./include -isystem ./include-fixed t.c -mtune=generic
-march=x86-64 -O2
options enabled: -faggressive-loop-optimizations -falign-functions
-falign-jumps -falign-labels -falign-loops -fallocation-dce
-fasynchronous-unwind-tables -fauto-inc-dec -fbranch-count-reg
-fcaller-saves -fcode-hoisting -fcombine-stack-adjustments -fcompare-elim
-fcprop-registers -fcrossjumping -fcse-follow-jumps -fdefer-pop
-fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively
-fdwarf2-cfi-asm -fearly-inlining -feliminate-unused-debug-symbols
...
Oh, you are right that there's a significant change (I fixed the newline):
BEFORE:
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
options passed: -v a.c -mtune=generic -march=x86-64
options enabled: -faggressive-loop-optimizations -fallocation-dce
-fasynchronous-unwind-tables -fauto-inc-dec -fdelete-null-pointer-checks
-fdwarf2-cfi-asm -fearly-inlining -feliminate-unused-debug-symbols
-feliminate-unused-debug-types -ffp-int-builtin-inexact -ffunction-cse
-fgcse-lm -fgnu-unique -fident -finline-atomics -fipa-stack-alignment
-fira-hoist-pressure -fira-share-save-slots -fira-share-spill-slots
-fivopts -fkeep-static-consts -fleading-underscore -flifetime-dse
-fmath-errno -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
-freg-struct-return -fsched-critical-path-heuristic
-fsched-dep-count-heuristic -fsched-group-heuristic -fsched-interblock
-fsched-last-insn-heuristic -fsched-rank-heuristic -fsched-spec
-fsched-spec-insn-heuristic -fsched-stalled-insns-dep -fschedule-fusion
-fsemantic-interposition -fshow-column -fshrink-wrap-separate
-fsigned-zeros -fsplit-ivs-in-unroller -fssa-backprop -fstdarg-opt
-fstrict-volatile-bitfields -fsync-libcalls -ftrapping-math -ftree-cselim
-ftree-forwprop -ftree-loop-if-convert -ftree-loop-im -ftree-loop-ivcanon
-ftree-loop-optimize -ftree-parallelize-loops= -ftree-phiprop
-ftree-reassoc -ftree-scev-cprop -funit-at-a-time -funwind-tables
-fvar-tracking -fvar-tracking-assignments -fzero-initialized-in-bss
-m128bit-long-double -m64 -m80387 -malign-stringops
-mavx256-split-unaligned-load -mavx256-split-unaligned-store
-mfancy-math-387 -mfp-ret-in-387 -mfxsr -mglibc -mieee-fp -mlong-double-80
-mmmx -mno-sse4 -mpush-args -mred-zone -msse -msse2 -mstv
-mtls-direct-seg-refs -mvzeroupper
Compiler executable checksum: 00000000000000000000000000000000
AFTER:
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C17 11.0.0 20201123 (experimental) -dumpbase-ext .c -mtune=generic
-march=x86-64
Compiler executable checksum: 36558a9ca3607b6821d78562377c56da
For -fverbose-asm we get something similar:
BEFORE:
# GNU C17 (SUSE Linux) version 10.2.1 20201117 [revision
98ba03ffe0b9f37b4916ce6238fad754e00d720b] (x86_64-suse-linux)
# compiled by GNU C version 10.2.1 20201117 [revision
98ba03ffe0b9f37b4916ce6238fad754e00d720b], GMP version 6.2.0, MPFR version
4.1.0, MPC version 1.2.1, isl version isl-0.22.1-GMP
# GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
# options passed: a.c -mtune=generic -march=x86-64 -auxbase-strip before.s
# -fverbose-asm
# options enabled: -faggressive-loop-optimizations -fallocation-dce
# -fasynchronous-unwind-tables -fauto-inc-dec -fdelete-null-pointer-checks
# -fdwarf2-cfi-asm -fearly-inlining -feliminate-unused-debug-symbols
# -feliminate-unused-debug-types -ffp-int-builtin-inexact -ffunction-cse
AFTER:
# GNU C17 (GCC) version 11.0.0 20201123 (experimental) (x86_64-pc-linux-gnu)
# compiled by GNU C version 10.2.1 20201117 [revision
98ba03ffe0b9f37b4916ce6238fad754e00d720b], GMP version 6.2.0, MPFR version
4.1.0, MPC version 1.2.1, isl version none
# GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
# GNU C17 11.0.0 20201123 (experimental) -dumpbase-ext .c -mtune=generic
-march=x86-64
but after the change it will most definitely _not_ include all the -f options
implied by -O2? So how does a standard -O2 -fverbose-asm compare?
How does -Q -v compare? How does the producer string in dwarf
compare (I guess that's actually equal since we now use that reporting style).
Yes, dwarf output is the same:
BEFORE:
<c> DW_AT_producer : (indirect string, offset: 0x0): GNU C17 11.0.0
20201123 (experimental) -dumpbase-ext .c -mtune=generic -march=x86-64 -g
AFTER:
<c> DW_AT_producer : (indirect string, offset: 0x0): GNU C17 10.2.1
20201117 [revision 98ba03ffe0b9f37b4916ce6238fad754e00d720b] -mtune=generic
-march=x86-64 -g
So the question is: do we really need to preserve the "options enabled" report?
It's far from being complete
as it e.g. ignores enum options like:
-fsched-stalled-insns-dep=<number>
-fsched-stalled-insns=<number>
-fsimd-cost-model=[unlimited|dynamic|cheap|very-cheap] unlimited
-fstack-check=[no|generic|specific]
-fstack-reuse=[all|named_vars|none] all
...
Well, gcc -Q -help=optimize <options_used> seems a better hint for me.
Thoughts?
Thanks,
Martin
Thanks,
Richard.
Thanks,
Martin
Richard.