diff mbox series

[stage1] Change semantics of -frecord-gcc-switches and add -frecord-gcc-switches-format.

Message ID 92bec310-4955-6fe0-df51-ed39f82f5c3b@suse.cz
State New
Headers show
Series [stage1] Change semantics of -frecord-gcc-switches and add -frecord-gcc-switches-format. | expand

Commit Message

Martin Liška March 17, 2020, 1:53 p.m. UTC
Hi.

I'm sending enhanced patch that makes the following changes:
- a new option -frecord-gcc-switches-format is added; the option
   selects format (processed, driver) for all options that record
   GCC command line
- Dwarf gen_produce_string is now used in -fverbose-asm
- The .s file is affected in the following way:

BEFORE:

# GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
#	compiled by GNU C version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

# GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
# options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
# -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
# -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx
# -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1
# -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
# -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd
# -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
# -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
# -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku
# -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
# -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b
# -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
# --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
# -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
# options enabled:  -faggressive-loop-optimizations -fassume-phsa
# -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
# -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
# -feliminate-unused-debug-types -ffp-int-builtin-inexact -ffunction-cse
# -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging -fmath-errno
# -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
# -frecord-gcc-switches -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
# -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
# -mabm -madx -maes -malign-stringops -mavx -mavx2
# -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero -mcx16
# -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr -mglibc
# -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
# -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf -msha
# -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
# -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt -mxsaves

AFTER:

# GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
# GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -mtune=znver1 -g

That's the biggest change I made, but I hope it's acceptable.
Apart from that the patch simplifies and unifies places where save_decoded_options
options are transformed back to string representation.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed in next stage1?
Thanks,
Martin

Comments

Li, Pan2 via Gcc-patches March 17, 2020, 6:43 p.m. UTC | #1
Hi Martin,

I like the patch. It definitely serves our purposes at Oracle and 
provides another way to do what my previous patches did as well.

1) It keeps the backwards compatibility regarding -frecord-gcc-switches; 
therefore, removes my related doubts about your previous patch.

2) It still makes use of -frecord-gcc-switches. The new option is only 
to control the format. This addresses some previous objections to having 
a new option doing something similar. Now the new option controls the 
behaviour of the existing one and that behaviour can be further extended.

3) It uses an environment variable as Jakub suggested.

The patch looks good and I confirm that it works for our purposes.

Having said that, I have to ask for recognition in this patch for my and 
my company's contributions. Can you please keep my name and my work 
email in the changelog and in the commit message?

Thanks
Egeyar



On 3/17/20 2:53 PM, Martin Liška wrote:
> Hi.
>
> I'm sending enhanced patch that makes the following changes:
> - a new option -frecord-gcc-switches-format is added; the option
>   selects format (processed, driver) for all options that record
>   GCC command line
> - Dwarf gen_produce_string is now used in -fverbose-asm
> - The .s file is affected in the following way:
>
> BEFORE:
>
> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision 
> 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
> #    compiled by GNU C version 9.2.1 20200128 [revision 
> 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR 
> version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
>
> # GGC heuristics: --param ggc-min-expand=100 --param 
> ggc-min-heapsize=131072
> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi 
> -mno-sgx
> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 
> -msse4.1
> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er 
> -mno-avx512cd
> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma 
> -mno-avx512vbmi
> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero 
> -mno-pku
> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b
> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
> # -feliminate-unused-debug-types -ffp-int-builtin-inexact -ffunction-cse
> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging -fmath-errno
> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
> # -frecord-gcc-switches -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
> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64 
> -m80387
> # -mabm -madx -maes -malign-stringops -mavx -mavx2
> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero 
> -mcx16
> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr -mglibc
> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf -msha
> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt -mxsaves
>
> AFTER:
>
> # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx 
> -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe 
> -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop 
> -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 
> -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase 
> -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f 
> -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 
> -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw 
> -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps 
> -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku -mno-rdpid 
> -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes 
> -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b 
> -mno-waitpkg -mno-cldemote -mno-ptwrite -mno-avx512bf16 -mno-enqcmd 
> -mno-avx512vp2intersect --param=l1-cache-size=32 
> --param=l1-cache-line-size=64 --param=l2-cache-size=512 -mtune=znver1 -g
>
> That's the biggest change I made, but I hope it's acceptable.
> Apart from that the patch simplifies and unifies places where 
> save_decoded_options
> options are transformed back to string representation.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed in next stage1?
> Thanks,
> Martin
Martin Liška March 18, 2020, 9:05 a.m. UTC | #2
On 3/17/20 7:43 PM, Egeyar Bagcioglu wrote:
> Hi Martin,
> 
> I like the patch. It definitely serves our purposes at Oracle and provides another way to do what my previous patches did as well.
> 
> 1) It keeps the backwards compatibility regarding -frecord-gcc-switches; therefore, removes my related doubts about your previous patch.
> 
> 2) It still makes use of -frecord-gcc-switches. The new option is only to control the format. This addresses some previous objections to having a new option doing something similar. Now the new option controls the behaviour of the existing one and that behaviour can be further extended.
> 
> 3) It uses an environment variable as Jakub suggested.
> 
> The patch looks good and I confirm that it works for our purposes.

Hello.

Thank you for the support.

> 
> Having said that, I have to ask for recognition in this patch for my and my company's contributions. Can you please keep my name and my work email in the changelog and in the commit message?

Sure, sorry I forgot.

Martin

> 
> Thanks
> Egeyar
> 
> 
> 
> On 3/17/20 2:53 PM, Martin Liška wrote:
>> Hi.
>>
>> I'm sending enhanced patch that makes the following changes:
>> - a new option -frecord-gcc-switches-format is added; the option
>>   selects format (processed, driver) for all options that record
>>   GCC command line
>> - Dwarf gen_produce_string is now used in -fverbose-asm
>> - The .s file is affected in the following way:
>>
>> BEFORE:
>>
>> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
>> #    compiled by GNU C version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
>>
>> # GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
>> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
>> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
>> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx
>> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1
>> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
>> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd
>> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
>> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
>> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku
>> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
>> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b
>> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
>> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
>> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
>> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
>> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
>> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
>> # -feliminate-unused-debug-types -ffp-int-builtin-inexact -ffunction-cse
>> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging -fmath-errno
>> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
>> # -frecord-gcc-switches -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
>> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
>> # -mabm -madx -maes -malign-stringops -mavx -mavx2
>> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero -mcx16
>> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr -mglibc
>> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
>> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf -msha
>> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
>> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt -mxsaves
>>
>> AFTER:
>>
>> # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
>> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -mtune=znver1 -g
>>
>> That's the biggest change I made, but I hope it's acceptable.
>> Apart from that the patch simplifies and unifies places where save_decoded_options
>> options are transformed back to string representation.
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> Ready to be installed in next stage1?
>> Thanks,
>> Martin
>
Li, Pan2 via Gcc-patches April 3, 2020, 6:15 p.m. UTC | #3
On 3/18/20 10:05 AM, Martin Liška wrote:
> On 3/17/20 7:43 PM, Egeyar Bagcioglu wrote:
>> Hi Martin,
>>
>> I like the patch. It definitely serves our purposes at Oracle and 
>> provides another way to do what my previous patches did as well.
>>
>> 1) It keeps the backwards compatibility regarding 
>> -frecord-gcc-switches; therefore, removes my related doubts about 
>> your previous patch.
>>
>> 2) It still makes use of -frecord-gcc-switches. The new option is 
>> only to control the format. This addresses some previous objections 
>> to having a new option doing something similar. Now the new option 
>> controls the behaviour of the existing one and that behaviour can be 
>> further extended.
>>
>> 3) It uses an environment variable as Jakub suggested.
>>
>> The patch looks good and I confirm that it works for our purposes.
>
> Hello.
>
> Thank you for the support.
>
>>
>> Having said that, I have to ask for recognition in this patch for my 
>> and my company's contributions. Can you please keep my name and my 
>> work email in the changelog and in the commit message?
>
> Sure, sorry I forgot.

Hi Martin,

I noticed that some comments in the patch were still referring to 
--record-gcc-command-line, the option I suggested earlier. I updated 
those comments to mention -frecord-gcc-switches-format instead and also 
added my name to the patch as you agreed above. I attached the updated 
patch. We are starting to use this patch in the specific domain where we 
need its functionality.

Regards
Egeyar


>
> Martin
>
>>
>> Thanks
>> Egeyar
>>
>>
>>
>> On 3/17/20 2:53 PM, Martin Liška wrote:
>>> Hi.
>>>
>>> I'm sending enhanced patch that makes the following changes:
>>> - a new option -frecord-gcc-switches-format is added; the option
>>>   selects format (processed, driver) for all options that record
>>>   GCC command line
>>> - Dwarf gen_produce_string is now used in -fverbose-asm
>>> - The .s file is affected in the following way:
>>>
>>> BEFORE:
>>>
>>> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision 
>>> 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
>>> #    compiled by GNU C version 9.2.1 20200128 [revision 
>>> 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR 
>>> version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
>>>
>>> # GGC heuristics: --param ggc-min-expand=100 --param 
>>> ggc-min-heapsize=131072
>>> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
>>> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
>>> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi 
>>> -mno-sgx
>>> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 
>>> -msse4.1
>>> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
>>> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er 
>>> -mno-avx512cd
>>> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
>>> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma 
>>> -mno-avx512vbmi
>>> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero 
>>> -mno-pku
>>> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
>>> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri 
>>> -mno-movdir64b
>>> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
>>> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
>>> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
>>> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
>>> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
>>> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
>>> # -feliminate-unused-debug-types -ffp-int-builtin-inexact 
>>> -ffunction-cse
>>> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging 
>>> -fmath-errno
>>> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
>>> # -frecord-gcc-switches -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
>>> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64 
>>> -m80387
>>> # -mabm -madx -maes -malign-stringops -mavx -mavx2
>>> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero 
>>> -mcx16
>>> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr 
>>> -mglibc
>>> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
>>> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf 
>>> -msha
>>> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
>>> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt 
>>> -mxsaves
>>>
>>> AFTER:
>>>
>>> # GGC heuristics: --param ggc-min-expand=30 --param 
>>> ggc-min-heapsize=4096
>>> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx 
>>> -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe 
>>> -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 
>>> -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm 
>>> -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd 
>>> -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt 
>>> -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf 
>>> -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq 
>>> -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi 
>>> -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero 
>>> -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 
>>> -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg 
>>> -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite 
>>> -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect 
>>> --param=l1-cache-size=32 --param=l1-cache-line-size=64 
>>> --param=l2-cache-size=512 -mtune=znver1 -g
>>>
>>> That's the biggest change I made, but I hope it's acceptable.
>>> Apart from that the patch simplifies and unifies places where 
>>> save_decoded_options
>>> options are transformed back to string representation.
>>>
>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>
>>> Ready to be installed in next stage1?
>>> Thanks,
>>> Martin
>>
>
Martin Liška April 6, 2020, 7:09 a.m. UTC | #4
On 4/3/20 8:15 PM, Egeyar Bagcioglu wrote:
> Hi Martin,

Hello.

> 
> I noticed that some comments in the patch were still referring to --record-gcc-command-line, the option I suggested earlier. I updated those comments to mention -frecord-gcc-switches-format instead and also added my name to the patch as you agreed above.

Yes, thank you for it.

> I attached the updated patch. We are starting to use this patch in the specific domain where we need its functionality.

Great, that would allow us to have the patch tested.

Martin

> 
> Regards
> Egeyar
Martin Liška May 15, 2020, 9:58 a.m. UTC | #5
We're in stage1: PING^1

On 4/3/20 8:15 PM, Egeyar Bagcioglu wrote:
> 
> 
> On 3/18/20 10:05 AM, Martin Liška wrote:
>> On 3/17/20 7:43 PM, Egeyar Bagcioglu wrote:
>>> Hi Martin,
>>>
>>> I like the patch. It definitely serves our purposes at Oracle and provides another way to do what my previous patches did as well.
>>>
>>> 1) It keeps the backwards compatibility regarding -frecord-gcc-switches; therefore, removes my related doubts about your previous patch.
>>>
>>> 2) It still makes use of -frecord-gcc-switches. The new option is only to control the format. This addresses some previous objections to having a new option doing something similar. Now the new option controls the behaviour of the existing one and that behaviour can be further extended.
>>>
>>> 3) It uses an environment variable as Jakub suggested.
>>>
>>> The patch looks good and I confirm that it works for our purposes.
>>
>> Hello.
>>
>> Thank you for the support.
>>
>>>
>>> Having said that, I have to ask for recognition in this patch for my and my company's contributions. Can you please keep my name and my work email in the changelog and in the commit message?
>>
>> Sure, sorry I forgot.
> 
> Hi Martin,
> 
> I noticed that some comments in the patch were still referring to --record-gcc-command-line, the option I suggested earlier. I updated those comments to mention -frecord-gcc-switches-format instead and also added my name to the patch as you agreed above. I attached the updated patch. We are starting to use this patch in the specific domain where we need its functionality.
> 
> Regards
> Egeyar
> 
> 
>>
>> Martin
>>
>>>
>>> Thanks
>>> Egeyar
>>>
>>>
>>>
>>> On 3/17/20 2:53 PM, Martin Liška wrote:
>>>> Hi.
>>>>
>>>> I'm sending enhanced patch that makes the following changes:
>>>> - a new option -frecord-gcc-switches-format is added; the option
>>>>   selects format (processed, driver) for all options that record
>>>>   GCC command line
>>>> - Dwarf gen_produce_string is now used in -fverbose-asm
>>>> - The .s file is affected in the following way:
>>>>
>>>> BEFORE:
>>>>
>>>> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
>>>> #    compiled by GNU C version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
>>>>
>>>> # GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
>>>> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
>>>> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
>>>> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx
>>>> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1
>>>> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
>>>> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd
>>>> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
>>>> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
>>>> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku
>>>> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
>>>> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b
>>>> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
>>>> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
>>>> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
>>>> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
>>>> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
>>>> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
>>>> # -feliminate-unused-debug-types -ffp-int-builtin-inexact -ffunction-cse
>>>> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging -fmath-errno
>>>> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
>>>> # -frecord-gcc-switches -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
>>>> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
>>>> # -mabm -madx -maes -malign-stringops -mavx -mavx2
>>>> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero -mcx16
>>>> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr -mglibc
>>>> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
>>>> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf -msha
>>>> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
>>>> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt -mxsaves
>>>>
>>>> AFTER:
>>>>
>>>> # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
>>>> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -mtune=znver1 -g
>>>>
>>>> That's the biggest change I made, but I hope it's acceptable.
>>>> Apart from that the patch simplifies and unifies places where save_decoded_options
>>>> options are transformed back to string representation.
>>>>
>>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>>
>>>> Ready to be installed in next stage1?
>>>> Thanks,
>>>> Martin
>>>
>>
>
Martin Liška June 2, 2020, 9:16 a.m. UTC | #6
PING^2

On 5/15/20 11:58 AM, Martin Liška wrote:
> We're in stage1: PING^1
> 
> On 4/3/20 8:15 PM, Egeyar Bagcioglu wrote:
>>
>>
>> On 3/18/20 10:05 AM, Martin Liška wrote:
>>> On 3/17/20 7:43 PM, Egeyar Bagcioglu wrote:
>>>> Hi Martin,
>>>>
>>>> I like the patch. It definitely serves our purposes at Oracle and provides another way to do what my previous patches did as well.
>>>>
>>>> 1) It keeps the backwards compatibility regarding -frecord-gcc-switches; therefore, removes my related doubts about your previous patch.
>>>>
>>>> 2) It still makes use of -frecord-gcc-switches. The new option is only to control the format. This addresses some previous objections to having a new option doing something similar. Now the new option controls the behaviour of the existing one and that behaviour can be further extended.
>>>>
>>>> 3) It uses an environment variable as Jakub suggested.
>>>>
>>>> The patch looks good and I confirm that it works for our purposes.
>>>
>>> Hello.
>>>
>>> Thank you for the support.
>>>
>>>>
>>>> Having said that, I have to ask for recognition in this patch for my and my company's contributions. Can you please keep my name and my work email in the changelog and in the commit message?
>>>
>>> Sure, sorry I forgot.
>>
>> Hi Martin,
>>
>> I noticed that some comments in the patch were still referring to --record-gcc-command-line, the option I suggested earlier. I updated those comments to mention -frecord-gcc-switches-format instead and also added my name to the patch as you agreed above. I attached the updated patch. We are starting to use this patch in the specific domain where we need its functionality.
>>
>> Regards
>> Egeyar
>>
>>
>>>
>>> Martin
>>>
>>>>
>>>> Thanks
>>>> Egeyar
>>>>
>>>>
>>>>
>>>> On 3/17/20 2:53 PM, Martin Liška wrote:
>>>>> Hi.
>>>>>
>>>>> I'm sending enhanced patch that makes the following changes:
>>>>> - a new option -frecord-gcc-switches-format is added; the option
>>>>>   selects format (processed, driver) for all options that record
>>>>>   GCC command line
>>>>> - Dwarf gen_produce_string is now used in -fverbose-asm
>>>>> - The .s file is affected in the following way:
>>>>>
>>>>> BEFORE:
>>>>>
>>>>> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
>>>>> #    compiled by GNU C version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
>>>>>
>>>>> # GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
>>>>> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
>>>>> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
>>>>> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx
>>>>> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1
>>>>> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
>>>>> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd
>>>>> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
>>>>> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
>>>>> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku
>>>>> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
>>>>> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b
>>>>> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
>>>>> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
>>>>> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
>>>>> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
>>>>> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
>>>>> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
>>>>> # -feliminate-unused-debug-types -ffp-int-builtin-inexact -ffunction-cse
>>>>> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging -fmath-errno
>>>>> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
>>>>> # -frecord-gcc-switches -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
>>>>> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
>>>>> # -mabm -madx -maes -malign-stringops -mavx -mavx2
>>>>> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero -mcx16
>>>>> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr -mglibc
>>>>> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
>>>>> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf -msha
>>>>> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
>>>>> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt -mxsaves
>>>>>
>>>>> AFTER:
>>>>>
>>>>> # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
>>>>> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -mtune=znver1 -g
>>>>>
>>>>> That's the biggest change I made, but I hope it's acceptable.
>>>>> Apart from that the patch simplifies and unifies places where save_decoded_options
>>>>> options are transformed back to string representation.
>>>>>
>>>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>>>
>>>>> Ready to be installed in next stage1?
>>>>> Thanks,
>>>>> Martin
>>>>
>>>
>>
>
Martin Liška June 16, 2020, 12:49 p.m. UTC | #7
PING^3

On 6/2/20 11:16 AM, Martin Liška wrote:
> PING^2
> 
> On 5/15/20 11:58 AM, Martin Liška wrote:
>> We're in stage1: PING^1
>>
>> On 4/3/20 8:15 PM, Egeyar Bagcioglu wrote:
>>>
>>>
>>> On 3/18/20 10:05 AM, Martin Liška wrote:
>>>> On 3/17/20 7:43 PM, Egeyar Bagcioglu wrote:
>>>>> Hi Martin,
>>>>>
>>>>> I like the patch. It definitely serves our purposes at Oracle and provides another way to do what my previous patches did as well.
>>>>>
>>>>> 1) It keeps the backwards compatibility regarding -frecord-gcc-switches; therefore, removes my related doubts about your previous patch.
>>>>>
>>>>> 2) It still makes use of -frecord-gcc-switches. The new option is only to control the format. This addresses some previous objections to having a new option doing something similar. Now the new option controls the behaviour of the existing one and that behaviour can be further extended.
>>>>>
>>>>> 3) It uses an environment variable as Jakub suggested.
>>>>>
>>>>> The patch looks good and I confirm that it works for our purposes.
>>>>
>>>> Hello.
>>>>
>>>> Thank you for the support.
>>>>
>>>>>
>>>>> Having said that, I have to ask for recognition in this patch for my and my company's contributions. Can you please keep my name and my work email in the changelog and in the commit message?
>>>>
>>>> Sure, sorry I forgot.
>>>
>>> Hi Martin,
>>>
>>> I noticed that some comments in the patch were still referring to --record-gcc-command-line, the option I suggested earlier. I updated those comments to mention -frecord-gcc-switches-format instead and also added my name to the patch as you agreed above. I attached the updated patch. We are starting to use this patch in the specific domain where we need its functionality.
>>>
>>> Regards
>>> Egeyar
>>>
>>>
>>>>
>>>> Martin
>>>>
>>>>>
>>>>> Thanks
>>>>> Egeyar
>>>>>
>>>>>
>>>>>
>>>>> On 3/17/20 2:53 PM, Martin Liška wrote:
>>>>>> Hi.
>>>>>>
>>>>>> I'm sending enhanced patch that makes the following changes:
>>>>>> - a new option -frecord-gcc-switches-format is added; the option
>>>>>>   selects format (processed, driver) for all options that record
>>>>>>   GCC command line
>>>>>> - Dwarf gen_produce_string is now used in -fverbose-asm
>>>>>> - The .s file is affected in the following way:
>>>>>>
>>>>>> BEFORE:
>>>>>>
>>>>>> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
>>>>>> #    compiled by GNU C version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
>>>>>>
>>>>>> # GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
>>>>>> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
>>>>>> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
>>>>>> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx
>>>>>> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1
>>>>>> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
>>>>>> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd
>>>>>> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
>>>>>> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
>>>>>> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku
>>>>>> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
>>>>>> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b
>>>>>> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
>>>>>> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
>>>>>> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
>>>>>> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
>>>>>> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
>>>>>> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
>>>>>> # -feliminate-unused-debug-types -ffp-int-builtin-inexact -ffunction-cse
>>>>>> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging -fmath-errno
>>>>>> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
>>>>>> # -frecord-gcc-switches -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
>>>>>> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
>>>>>> # -mabm -madx -maes -malign-stringops -mavx -mavx2
>>>>>> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero -mcx16
>>>>>> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr -mglibc
>>>>>> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
>>>>>> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf -msha
>>>>>> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
>>>>>> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt -mxsaves
>>>>>>
>>>>>> AFTER:
>>>>>>
>>>>>> # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
>>>>>> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -mtune=znver1 -g
>>>>>>
>>>>>> That's the biggest change I made, but I hope it's acceptable.
>>>>>> Apart from that the patch simplifies and unifies places where save_decoded_options
>>>>>> options are transformed back to string representation.
>>>>>>
>>>>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>>>>
>>>>>> Ready to be installed in next stage1?
>>>>>> Thanks,
>>>>>> Martin
>>>>>
>>>>
>>>
>>
>
Qing Zhao July 21, 2020, 4:24 p.m. UTC | #8
PING^4. 

Our company is waiting for this patch to be committed to upstream.

Thanks a lot.

Qing

> On Jun 16, 2020, at 7:49 AM, Martin Liška <mliska@suse.cz> wrote:
> 
> PING^3
> 
> On 6/2/20 11:16 AM, Martin Liška wrote:
>> PING^2
>> On 5/15/20 11:58 AM, Martin Liška wrote:
>>> We're in stage1: PING^1
>>> 
>>> On 4/3/20 8:15 PM, Egeyar Bagcioglu wrote:
>>>> 
>>>> 
>>>> On 3/18/20 10:05 AM, Martin Liška wrote:
>>>>> On 3/17/20 7:43 PM, Egeyar Bagcioglu wrote:
>>>>>> Hi Martin,
>>>>>> 
>>>>>> I like the patch. It definitely serves our purposes at Oracle and provides another way to do what my previous patches did as well.
>>>>>> 
>>>>>> 1) It keeps the backwards compatibility regarding -frecord-gcc-switches; therefore, removes my related doubts about your previous patch.
>>>>>> 
>>>>>> 2) It still makes use of -frecord-gcc-switches. The new option is only to control the format. This addresses some previous objections to having a new option doing something similar. Now the new option controls the behaviour of the existing one and that behaviour can be further extended.
>>>>>> 
>>>>>> 3) It uses an environment variable as Jakub suggested.
>>>>>> 
>>>>>> The patch looks good and I confirm that it works for our purposes.
>>>>> 
>>>>> Hello.
>>>>> 
>>>>> Thank you for the support.
>>>>> 
>>>>>> 
>>>>>> Having said that, I have to ask for recognition in this patch for my and my company's contributions. Can you please keep my name and my work email in the changelog and in the commit message?
>>>>> 
>>>>> Sure, sorry I forgot.
>>>> 
>>>> Hi Martin,
>>>> 
>>>> I noticed that some comments in the patch were still referring to --record-gcc-command-line, the option I suggested earlier. I updated those comments to mention -frecord-gcc-switches-format instead and also added my name to the patch as you agreed above. I attached the updated patch. We are starting to use this patch in the specific domain where we need its functionality.
>>>> 
>>>> Regards
>>>> Egeyar
>>>> 
>>>> 
>>>>> 
>>>>> Martin
>>>>> 
>>>>>> 
>>>>>> Thanks
>>>>>> Egeyar
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On 3/17/20 2:53 PM, Martin Liška wrote:
>>>>>>> Hi.
>>>>>>> 
>>>>>>> I'm sending enhanced patch that makes the following changes:
>>>>>>> - a new option -frecord-gcc-switches-format is added; the option
>>>>>>>   selects format (processed, driver) for all options that record
>>>>>>>   GCC command line
>>>>>>> - Dwarf gen_produce_string is now used in -fverbose-asm
>>>>>>> - The .s file is affected in the following way:
>>>>>>> 
>>>>>>> BEFORE:
>>>>>>> 
>>>>>>> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
>>>>>>> #    compiled by GNU C version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
>>>>>>> 
>>>>>>> # GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
>>>>>>> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
>>>>>>> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
>>>>>>> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx
>>>>>>> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1
>>>>>>> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
>>>>>>> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd
>>>>>>> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
>>>>>>> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
>>>>>>> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku
>>>>>>> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
>>>>>>> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b
>>>>>>> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
>>>>>>> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
>>>>>>> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
>>>>>>> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
>>>>>>> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
>>>>>>> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
>>>>>>> # -feliminate-unused-debug-types -ffp-int-builtin-inexact -ffunction-cse
>>>>>>> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging -fmath-errno
>>>>>>> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
>>>>>>> # -frecord-gcc-switches -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
>>>>>>> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
>>>>>>> # -mabm -madx -maes -malign-stringops -mavx -mavx2
>>>>>>> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero -mcx16
>>>>>>> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr -mglibc
>>>>>>> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
>>>>>>> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf -msha
>>>>>>> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
>>>>>>> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt -mxsaves
>>>>>>> 
>>>>>>> AFTER:
>>>>>>> 
>>>>>>> # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
>>>>>>> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -mtune=znver1 -g
>>>>>>> 
>>>>>>> That's the biggest change I made, but I hope it's acceptable.
>>>>>>> Apart from that the patch simplifies and unifies places where save_decoded_options
>>>>>>> options are transformed back to string representation.
>>>>>>> 
>>>>>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>>>>> 
>>>>>>> Ready to be installed in next stage1?
>>>>>>> Thanks,
>>>>>>> Martin
>>>>>> 
>>>>> 
>>>> 
>>> 
>
Martin Liška July 23, 2020, 10:07 a.m. UTC | #9
On 7/21/20 6:24 PM, Qing Zhao wrote:
> 4.
> 
> Our company is waiting for this patch to be committed to upstream.

Hello.

Please note that patch review can sometimes take some time.
You can still install the patch to your local branch and note that
the next major release will be released in about 9 months.

Martin
Qing Zhao July 23, 2020, 3:01 p.m. UTC | #10
Hi,

Thanks a lot for the info.

> On Jul 23, 2020, at 5:07 AM, Martin Liška <mliska@suse.cz> wrote:
> 
> On 7/21/20 6:24 PM, Qing Zhao wrote:
>> 4.
>> Our company is waiting for this patch to be committed to upstream.
> 
> Hello.
> 
> Please note that patch review can sometimes take some time.

Yes, I understand. 
However, this patch has been submitted for review since March this year, 4 months passed.
Just want to make sure that this patch is not ignored and someone will take a look at it.

> You can still install the patch to your local branch and note that
> the next major release will be released in about 9 months.

Our production build of GCC needs this patch for our important application. 
So, if this patch will be changed due to some new comments from the reviewers, the back porting will
Need to be redone later, it’s really not convenient for us. 

I am hoping the review process of this patch can be done soon, it has been waiting for so long time already.

Thanks.

Qing

> 
> Martin
Martin Liška July 24, 2020, 1:43 p.m. UTC | #11
On 7/23/20 5:01 PM, Qing Zhao wrote:
> Hi,
> 
> Thanks a lot for the info.
> 
>> On Jul 23, 2020, at 5:07 AM, Martin Liška <mliska@suse.cz> wrote:
>>
>> On 7/21/20 6:24 PM, Qing Zhao wrote:
>>> 4.
>>> Our company is waiting for this patch to be committed to upstream.
>>
>> Hello.
>>
>> Please note that patch review can sometimes take some time.
> 
> Yes, I understand.
> However, this patch has been submitted for review since March this year, 4 months passed.
> Just want to make sure that this patch is not ignored and someone will take a look at it.

No, it's not ignored and I you can rely on that it will appear in GCC 11.1.

> 
>> You can still install the patch to your local branch and note that
>> the next major release will be released in about 9 months.
> 
> Our production build of GCC needs this patch for our important application.
> So, if this patch will be changed due to some new comments from the reviewers, the back porting will
> Need to be redone later, it’s really not convenient for us.

Fully agree with that.

> 
> I am hoping the review process of this patch can be done soon, it has been waiting for so long time already.

Adding Jeff to CC, who can hopefully help us here.

Martin

> 
> Thanks.
> 
> Qing
> 
>>
>> Martin
>
Martin Liška Sept. 25, 2020, 2:55 p.m. UTC | #12
PING^5

On 7/21/20 6:24 PM, Qing Zhao wrote:
> PING^4.
> 
> Our company is waiting for this patch to be committed to upstream.
> 
> Thanks a lot.
> 
> Qing
> 
>> On Jun 16, 2020, at 7:49 AM, Martin Liška <mliska@suse.cz> wrote:
>>
>> PING^3
>>
>> On 6/2/20 11:16 AM, Martin Liška wrote:
>>> PING^2
>>> On 5/15/20 11:58 AM, Martin Liška wrote:
>>>> We're in stage1: PING^1
>>>>
>>>> On 4/3/20 8:15 PM, Egeyar Bagcioglu wrote:
>>>>>
>>>>>
>>>>> On 3/18/20 10:05 AM, Martin Liška wrote:
>>>>>> On 3/17/20 7:43 PM, Egeyar Bagcioglu wrote:
>>>>>>> Hi Martin,
>>>>>>>
>>>>>>> I like the patch. It definitely serves our purposes at Oracle and provides another way to do what my previous patches did as well.
>>>>>>>
>>>>>>> 1) It keeps the backwards compatibility regarding -frecord-gcc-switches; therefore, removes my related doubts about your previous patch.
>>>>>>>
>>>>>>> 2) It still makes use of -frecord-gcc-switches. The new option is only to control the format. This addresses some previous objections to having a new option doing something similar. Now the new option controls the behaviour of the existing one and that behaviour can be further extended.
>>>>>>>
>>>>>>> 3) It uses an environment variable as Jakub suggested.
>>>>>>>
>>>>>>> The patch looks good and I confirm that it works for our purposes.
>>>>>>
>>>>>> Hello.
>>>>>>
>>>>>> Thank you for the support.
>>>>>>
>>>>>>>
>>>>>>> Having said that, I have to ask for recognition in this patch for my and my company's contributions. Can you please keep my name and my work email in the changelog and in the commit message?
>>>>>>
>>>>>> Sure, sorry I forgot.
>>>>>
>>>>> Hi Martin,
>>>>>
>>>>> I noticed that some comments in the patch were still referring to --record-gcc-command-line, the option I suggested earlier. I updated those comments to mention -frecord-gcc-switches-format instead and also added my name to the patch as you agreed above. I attached the updated patch. We are starting to use this patch in the specific domain where we need its functionality.
>>>>>
>>>>> Regards
>>>>> Egeyar
>>>>>
>>>>>
>>>>>>
>>>>>> Martin
>>>>>>
>>>>>>>
>>>>>>> Thanks
>>>>>>> Egeyar
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 3/17/20 2:53 PM, Martin Liška wrote:
>>>>>>>> Hi.
>>>>>>>>
>>>>>>>> I'm sending enhanced patch that makes the following changes:
>>>>>>>> - a new option -frecord-gcc-switches-format is added; the option
>>>>>>>>    selects format (processed, driver) for all options that record
>>>>>>>>    GCC command line
>>>>>>>> - Dwarf gen_produce_string is now used in -fverbose-asm
>>>>>>>> - The .s file is affected in the following way:
>>>>>>>>
>>>>>>>> BEFORE:
>>>>>>>>
>>>>>>>> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
>>>>>>>> #    compiled by GNU C version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
>>>>>>>>
>>>>>>>> # GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
>>>>>>>> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
>>>>>>>> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
>>>>>>>> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx
>>>>>>>> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1
>>>>>>>> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
>>>>>>>> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd
>>>>>>>> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
>>>>>>>> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
>>>>>>>> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku
>>>>>>>> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
>>>>>>>> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b
>>>>>>>> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
>>>>>>>> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
>>>>>>>> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
>>>>>>>> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
>>>>>>>> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
>>>>>>>> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
>>>>>>>> # -feliminate-unused-debug-types -ffp-int-builtin-inexact -ffunction-cse
>>>>>>>> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging -fmath-errno
>>>>>>>> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
>>>>>>>> # -frecord-gcc-switches -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
>>>>>>>> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
>>>>>>>> # -mabm -madx -maes -malign-stringops -mavx -mavx2
>>>>>>>> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero -mcx16
>>>>>>>> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr -mglibc
>>>>>>>> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
>>>>>>>> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf -msha
>>>>>>>> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
>>>>>>>> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt -mxsaves
>>>>>>>>
>>>>>>>> AFTER:
>>>>>>>>
>>>>>>>> # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
>>>>>>>> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -mtune=znver1 -g
>>>>>>>>
>>>>>>>> That's the biggest change I made, but I hope it's acceptable.
>>>>>>>> Apart from that the patch simplifies and unifies places where save_decoded_options
>>>>>>>> options are transformed back to string representation.
>>>>>>>>
>>>>>>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>>>>>>
>>>>>>>> Ready to be installed in next stage1?
>>>>>>>> Thanks,
>>>>>>>> Martin
>>>>>>>
>>>>>>
>>>>>
>>>>
>>
>
Qing Zhao Sept. 25, 2020, 7:36 p.m. UTC | #13
> On Sep 25, 2020, at 9:55 AM, Martin Liška <mliska@suse.cz> wrote:
> 
> PING^5
> 

Thanks a lot for ping this patch again.

Hopefully it can be committed into GCC 11 very soon.

Qing
> On 7/21/20 6:24 PM, Qing Zhao wrote:
>> PING^4.
>> Our company is waiting for this patch to be committed to upstream.
>> Thanks a lot.
>> Qing
>>> On Jun 16, 2020, at 7:49 AM, Martin Liška <mliska@suse.cz> wrote:
>>> 
>>> PING^3
>>> 
>>> On 6/2/20 11:16 AM, Martin Liška wrote:
>>>> PING^2
>>>> On 5/15/20 11:58 AM, Martin Liška wrote:
>>>>> We're in stage1: PING^1
>>>>> 
>>>>> On 4/3/20 8:15 PM, Egeyar Bagcioglu wrote:
>>>>>> 
>>>>>> 
>>>>>> On 3/18/20 10:05 AM, Martin Liška wrote:
>>>>>>> On 3/17/20 7:43 PM, Egeyar Bagcioglu wrote:
>>>>>>>> Hi Martin,
>>>>>>>> 
>>>>>>>> I like the patch. It definitely serves our purposes at Oracle and provides another way to do what my previous patches did as well.
>>>>>>>> 
>>>>>>>> 1) It keeps the backwards compatibility regarding -frecord-gcc-switches; therefore, removes my related doubts about your previous patch.
>>>>>>>> 
>>>>>>>> 2) It still makes use of -frecord-gcc-switches. The new option is only to control the format. This addresses some previous objections to having a new option doing something similar. Now the new option controls the behaviour of the existing one and that behaviour can be further extended.
>>>>>>>> 
>>>>>>>> 3) It uses an environment variable as Jakub suggested.
>>>>>>>> 
>>>>>>>> The patch looks good and I confirm that it works for our purposes.
>>>>>>> 
>>>>>>> Hello.
>>>>>>> 
>>>>>>> Thank you for the support.
>>>>>>> 
>>>>>>>> 
>>>>>>>> Having said that, I have to ask for recognition in this patch for my and my company's contributions. Can you please keep my name and my work email in the changelog and in the commit message?
>>>>>>> 
>>>>>>> Sure, sorry I forgot.
>>>>>> 
>>>>>> Hi Martin,
>>>>>> 
>>>>>> I noticed that some comments in the patch were still referring to --record-gcc-command-line, the option I suggested earlier. I updated those comments to mention -frecord-gcc-switches-format instead and also added my name to the patch as you agreed above. I attached the updated patch. We are starting to use this patch in the specific domain where we need its functionality.
>>>>>> 
>>>>>> Regards
>>>>>> Egeyar
>>>>>> 
>>>>>> 
>>>>>>> 
>>>>>>> Martin
>>>>>>> 
>>>>>>>> 
>>>>>>>> Thanks
>>>>>>>> Egeyar
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On 3/17/20 2:53 PM, Martin Liška wrote:
>>>>>>>>> Hi.
>>>>>>>>> 
>>>>>>>>> I'm sending enhanced patch that makes the following changes:
>>>>>>>>> - a new option -frecord-gcc-switches-format is added; the option
>>>>>>>>>   selects format (processed, driver) for all options that record
>>>>>>>>>   GCC command line
>>>>>>>>> - Dwarf gen_produce_string is now used in -fverbose-asm
>>>>>>>>> - The .s file is affected in the following way:
>>>>>>>>> 
>>>>>>>>> BEFORE:
>>>>>>>>> 
>>>>>>>>> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
>>>>>>>>> #    compiled by GNU C version 9.2.1 20200128 [revision 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
>>>>>>>>> 
>>>>>>>>> # GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
>>>>>>>>> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
>>>>>>>>> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
>>>>>>>>> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx
>>>>>>>>> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1
>>>>>>>>> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
>>>>>>>>> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd
>>>>>>>>> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
>>>>>>>>> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
>>>>>>>>> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku
>>>>>>>>> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
>>>>>>>>> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b
>>>>>>>>> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
>>>>>>>>> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
>>>>>>>>> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
>>>>>>>>> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
>>>>>>>>> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
>>>>>>>>> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
>>>>>>>>> # -feliminate-unused-debug-types -ffp-int-builtin-inexact -ffunction-cse
>>>>>>>>> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging -fmath-errno
>>>>>>>>> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
>>>>>>>>> # -frecord-gcc-switches -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
>>>>>>>>> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
>>>>>>>>> # -mabm -madx -maes -malign-stringops -mavx -mavx2
>>>>>>>>> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero -mcx16
>>>>>>>>> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr -mglibc
>>>>>>>>> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
>>>>>>>>> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf -msha
>>>>>>>>> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
>>>>>>>>> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt -mxsaves
>>>>>>>>> 
>>>>>>>>> AFTER:
>>>>>>>>> 
>>>>>>>>> # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
>>>>>>>>> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -mtune=znver1 -g
>>>>>>>>> 
>>>>>>>>> That's the biggest change I made, but I hope it's acceptable.
>>>>>>>>> Apart from that the patch simplifies and unifies places where save_decoded_options
>>>>>>>>> options are transformed back to string representation.
>>>>>>>>> 
>>>>>>>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>>>>>>> 
>>>>>>>>> Ready to be installed in next stage1?
>>>>>>>>> Thanks,
>>>>>>>>> Martin
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>> 
>
Martin Liška Oct. 27, 2020, 10:56 a.m. UTC | #14
PING^6

The patch is in review process for more than 6 months, can please any global
reviewer take a look at it?

Thanks,
Martin

On 9/25/20 4:55 PM, Martin Liška wrote:
> PING^5
Qing Zhao Nov. 10, 2020, 8:53 p.m. UTC | #15
Jakub and Jeff,

PING^7 on the following patch proposed 8 months ago for gcc11:

https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542198.html <https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542198.html>

The deadline for gcc11 stage 1 is approaching.  The pinged patch is one that has been sent for review 8 months ago in order to 
Make into gcc11. 

And this is an important feature that our company is waiting for a long time. 

Could you please take a look at this patch and let us know whether it’s ready for commit into gcc11? 

Thanks a lot.

Qing




> On Oct 27, 2020, at 5:56 AM, Martin Liška <mliska@suse.cz> wrote:
> 
> PING^6
> 
> The patch is in review process for more than 6 months, can please any global
> reviewer take a look at it?
> 
> Thanks,
> Martin
> 
> On 9/25/20 4:55 PM, Martin Liška wrote:
>> PING^5
>
Jose E. Marchesi Nov. 13, 2020, 4:19 p.m. UTC | #16
> PING^7 on the following patch proposed 8 months ago for gcc11:
>
> https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542198.html
> <https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542198.html>
>
> The deadline for gcc11 stage 1 is approaching.  The pinged patch is
> one that has been sent for review 8 months ago in order to
> Make into gcc11. 
>
> And this is an important feature that our company is waiting for a long time. 
>
> Could you please take a look at this patch and let us know whether
> it’s ready for commit into gcc11?

ping
Martin Liška Nov. 16, 2020, 10:29 a.m. UTC | #17
On 11/10/20 9:53 PM, Qing Zhao wrote:
> The deadline for gcc11 stage 1 is approaching.  The pinged patch is one that has been sent for review 8 months ago in order to
> Make into gcc11.

Hello.

You didn't miss the deadline as all patches sent before stage1 can be reviewed even during stage3.
Note that many upstream developers (and maintainers) were busy with feature development and now
will be more time for a review.

Thanks for patience. You can bet on having that in GCC 11.1.0

Martin
Qing Zhao Nov. 16, 2020, 5:03 p.m. UTC | #18
> On Nov 16, 2020, at 4:29 AM, Martin Liška <mliska@suse.cz> wrote:
> 
> On 11/10/20 9:53 PM, Qing Zhao wrote:
>> The deadline for gcc11 stage 1 is approaching.  The pinged patch is one that has been sent for review 8 months ago in order to
>> Make into gcc11.
> 
> Hello.
> 
> You didn't miss the deadline as all patches sent before stage1 can be reviewed even during stage3.
> Note that many upstream developers (and maintainers) were busy with feature development and now
> will be more time for a review.
> 
> Thanks for patience. You can bet on having that in GCC 11.1.0

Thank you for this information.

Qing
> 
> Martin
Richard Biener Nov. 20, 2020, 9:49 a.m. UTC | #19
On Fri, Apr 3, 2020 at 8:15 PM Egeyar Bagcioglu
<egeyar.bagcioglu@oracle.com> wrote:
>
>
>
> On 3/18/20 10:05 AM, Martin Liška wrote:
> > On 3/17/20 7:43 PM, Egeyar Bagcioglu wrote:
> >> Hi Martin,
> >>
> >> I like the patch. It definitely serves our purposes at Oracle and
> >> provides another way to do what my previous patches did as well.
> >>
> >> 1) It keeps the backwards compatibility regarding
> >> -frecord-gcc-switches; therefore, removes my related doubts about
> >> your previous patch.
> >>
> >> 2) It still makes use of -frecord-gcc-switches. The new option is
> >> only to control the format. This addresses some previous objections
> >> to having a new option doing something similar. Now the new option
> >> controls the behaviour of the existing one and that behaviour can be
> >> further extended.
> >>
> >> 3) It uses an environment variable as Jakub suggested.
> >>
> >> The patch looks good and I confirm that it works for our purposes.
> >
> > Hello.
> >
> > Thank you for the support.
> >
> >>
> >> Having said that, I have to ask for recognition in this patch for my
> >> and my company's contributions. Can you please keep my name and my
> >> work email in the changelog and in the commit message?
> >
> > Sure, sorry I forgot.
>
> Hi Martin,
>
> I noticed that some comments in the patch were still referring to
> --record-gcc-command-line, the option I suggested earlier. I updated
> those comments to mention -frecord-gcc-switches-format instead and also
> added my name to the patch as you agreed above. I attached the updated
> patch. We are starting to use this patch in the specific domain where we
> need its functionality.

So while I like the addition of -frecord-gcc-switches-format to preserve
backward compatibility there are IMHO several issues with the patch.

For one, the target hook change to a void(void) hook makes it need to
duplicate too much internals.  Please make it take a const char *
argument, the actual text to output.

For second, I see no good reason to have different handling of
-grecord-gcc-switches vs. -frecord-gcc-switches - they should
produce the same content and thus -frecord-gcc-switches-format
should apply to -grecord-gcc-switches as well.

Now - I think what we output into the assembly file with -fverbose-asm
should _always_ be the processed arguments since the assembly
is produced by cc1, not gcc.

+/* Return value of env variable GCC_DRIVER_COMMAND_LINE if exists.
+   Otherwise return empty string.  */
+
+const char *
+get_driver_command_line ()
+{
+  const char *cmdline = getenv ("GCC_DRIVER_COMMAND_LINE");
+  return cmdline != NULL ? cmdline : "";
+}

I think silently emitting nothing is not a good idea.  In particular using
the environment to carry the driver command-line makes it difficult
to reproduce output with pasting commands as dumped by -v [-save-temps].
Likewise the driver seems to always populate GCC_DRIVER_COMMAND_LINE
even if not needed - why not look for -frecord-gcc-switches-format before
doing so?  I'd make -frecord-gcc-switches-format a driver only option
(only the driver can do sth about it) and amend -frecord-gcc-switches
with a -frecord-gcc-switches=FILE variant specifying the content.  The
driver would then substitute -frecord-gcc-switches-format=driver
with -frecord-gcc-switches=tempfile and dump the command line into
tempfile.  cc1 can then pick contents from tempfile or use the processed
variant if no contents are specified.

Richard.


> Regards
> Egeyar
>
>
> >
> > Martin
> >
> >>
> >> Thanks
> >> Egeyar
> >>
> >>
> >>
> >> On 3/17/20 2:53 PM, Martin Liška wrote:
> >>> Hi.
> >>>
> >>> I'm sending enhanced patch that makes the following changes:
> >>> - a new option -frecord-gcc-switches-format is added; the option
> >>>   selects format (processed, driver) for all options that record
> >>>   GCC command line
> >>> - Dwarf gen_produce_string is now used in -fverbose-asm
> >>> - The .s file is affected in the following way:
> >>>
> >>> BEFORE:
> >>>
> >>> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision
> >>> 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
> >>> #    compiled by GNU C version 9.2.1 20200128 [revision
> >>> 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR
> >>> version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
> >>>
> >>> # GGC heuristics: --param ggc-min-expand=100 --param
> >>> ggc-min-heapsize=131072
> >>> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
> >>> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
> >>> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi
> >>> -mno-sgx
> >>> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2
> >>> -msse4.1
> >>> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
> >>> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er
> >>> -mno-avx512cd
> >>> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
> >>> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma
> >>> -mno-avx512vbmi
> >>> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero
> >>> -mno-pku
> >>> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
> >>> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri
> >>> -mno-movdir64b
> >>> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
> >>> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
> >>> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
> >>> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
> >>> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
> >>> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
> >>> # -feliminate-unused-debug-types -ffp-int-builtin-inexact
> >>> -ffunction-cse
> >>> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging
> >>> -fmath-errno
> >>> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
> >>> # -frecord-gcc-switches -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
> >>> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64
> >>> -m80387
> >>> # -mabm -madx -maes -malign-stringops -mavx -mavx2
> >>> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero
> >>> -mcx16
> >>> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr
> >>> -mglibc
> >>> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
> >>> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf
> >>> -msha
> >>> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
> >>> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt
> >>> -mxsaves
> >>>
> >>> AFTER:
> >>>
> >>> # GGC heuristics: --param ggc-min-expand=30 --param
> >>> ggc-min-heapsize=4096
> >>> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx
> >>> -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe
> >>> -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4
> >>> -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm
> >>> -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd
> >>> -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt
> >>> -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf
> >>> -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq
> >>> -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
> >>> -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero
> >>> -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2
> >>> -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg
> >>> -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite
> >>> -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect
> >>> --param=l1-cache-size=32 --param=l1-cache-line-size=64
> >>> --param=l2-cache-size=512 -mtune=znver1 -g
> >>>
> >>> That's the biggest change I made, but I hope it's acceptable.
> >>> Apart from that the patch simplifies and unifies places where
> >>> save_decoded_options
> >>> options are transformed back to string representation.
> >>>
> >>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> >>>
> >>> Ready to be installed in next stage1?
> >>> Thanks,
> >>> Martin
> >>
> >
>
Martin Liška Nov. 23, 2020, 8:59 a.m. UTC | #20
On 11/20/20 10:49 AM, Richard Biener wrote:
> On Fri, Apr 3, 2020 at 8:15 PM Egeyar Bagcioglu
> <egeyar.bagcioglu@oracle.com> wrote:
>>
>>
>>
>> On 3/18/20 10:05 AM, Martin Liška wrote:
>>> On 3/17/20 7:43 PM, Egeyar Bagcioglu wrote:
>>>> Hi Martin,
>>>>
>>>> I like the patch. It definitely serves our purposes at Oracle and
>>>> provides another way to do what my previous patches did as well.
>>>>
>>>> 1) It keeps the backwards compatibility regarding
>>>> -frecord-gcc-switches; therefore, removes my related doubts about
>>>> your previous patch.
>>>>
>>>> 2) It still makes use of -frecord-gcc-switches. The new option is
>>>> only to control the format. This addresses some previous objections
>>>> to having a new option doing something similar. Now the new option
>>>> controls the behaviour of the existing one and that behaviour can be
>>>> further extended.
>>>>
>>>> 3) It uses an environment variable as Jakub suggested.
>>>>
>>>> The patch looks good and I confirm that it works for our purposes.
>>>
>>> Hello.
>>>
>>> Thank you for the support.
>>>
>>>>
>>>> Having said that, I have to ask for recognition in this patch for my
>>>> and my company's contributions. Can you please keep my name and my
>>>> work email in the changelog and in the commit message?
>>>
>>> Sure, sorry I forgot.
>>
>> Hi Martin,
>>
>> I noticed that some comments in the patch were still referring to
>> --record-gcc-command-line, the option I suggested earlier. I updated
>> those comments to mention -frecord-gcc-switches-format instead and also
>> added my name to the patch as you agreed above. I attached the updated
>> patch. We are starting to use this patch in the specific domain where we
>> need its functionality.
> 
> So while I like the addition of -frecord-gcc-switches-format to preserve
> backward compatibility there are IMHO several issues with the patch.

Hey.

> 
> For one, the target hook change to a void(void) hook makes it need to
> duplicate too much internals.  Please make it take a const char *
> argument, the actual text to output.

Agree with that, nice improvement.

> 
> For second, I see no good reason to have different handling of
> -grecord-gcc-switches vs. -frecord-gcc-switches - they should
> produce the same content and thus -frecord-gcc-switches-format
> should apply to -grecord-gcc-switches as well.

They do. Both respect the newly added -frecord-gcc-switches-format argument.

> 
> Now - I think what we output into the assembly file with -fverbose-asm
> should _always_ be the processed arguments since the assembly
> is produced by cc1, not gcc.

All right, changed that.

> 
> +/* Return value of env variable GCC_DRIVER_COMMAND_LINE if exists.
> +   Otherwise return empty string.  */
> +
> +const char *
> +get_driver_command_line ()
> +{
> +  const char *cmdline = getenv ("GCC_DRIVER_COMMAND_LINE");
> +  return cmdline != NULL ? cmdline : "";
> +}
> 
> I think silently emitting nothing is not a good idea.  In particular using
> the environment to carry the driver command-line makes it difficult
> to reproduce output with pasting commands as dumped by -v [-save-temps].
> Likewise the driver seems to always populate GCC_DRIVER_COMMAND_LINE
> even if not needed - why not look for -frecord-gcc-switches-format before
> doing so?  I'd make -frecord-gcc-switches-format a driver only option
> (only the driver can do sth about it) and amend -frecord-gcc-switches
> with a -frecord-gcc-switches=FILE variant specifying the content.  The
> driver would then substitute -frecord-gcc-switches-format=driver
> with -frecord-gcc-switches=tempfile and dump the command line into
> tempfile.  cc1 can then pick contents from tempfile or use the processed
> variant if no contents are specified.

I've just rewritten that to -frecord-gcc-switches-file option. Note that
we can't transform that to -frecord-gcc-switches=FILE as one can use:

-g frecord-gcc-switches-format=driver and so -frecord-gcc-switches is off.

Thoughts on the new version of the patch?
Thanks,
Martin

> 
> Richard.
> 
> 
>> Regards
>> Egeyar
>>
>>
>>>
>>> Martin
>>>
>>>>
>>>> Thanks
>>>> Egeyar
>>>>
>>>>
>>>>
>>>> On 3/17/20 2:53 PM, Martin Liška wrote:
>>>>> Hi.
>>>>>
>>>>> I'm sending enhanced patch that makes the following changes:
>>>>> - a new option -frecord-gcc-switches-format is added; the option
>>>>>    selects format (processed, driver) for all options that record
>>>>>    GCC command line
>>>>> - Dwarf gen_produce_string is now used in -fverbose-asm
>>>>> - The .s file is affected in the following way:
>>>>>
>>>>> BEFORE:
>>>>>
>>>>> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision
>>>>> 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
>>>>> #    compiled by GNU C version 9.2.1 20200128 [revision
>>>>> 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR
>>>>> version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
>>>>>
>>>>> # GGC heuristics: --param ggc-min-expand=100 --param
>>>>> ggc-min-heapsize=131072
>>>>> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
>>>>> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
>>>>> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi
>>>>> -mno-sgx
>>>>> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2
>>>>> -msse4.1
>>>>> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
>>>>> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er
>>>>> -mno-avx512cd
>>>>> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
>>>>> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma
>>>>> -mno-avx512vbmi
>>>>> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero
>>>>> -mno-pku
>>>>> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
>>>>> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri
>>>>> -mno-movdir64b
>>>>> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
>>>>> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
>>>>> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
>>>>> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
>>>>> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
>>>>> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
>>>>> # -feliminate-unused-debug-types -ffp-int-builtin-inexact
>>>>> -ffunction-cse
>>>>> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging
>>>>> -fmath-errno
>>>>> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
>>>>> # -frecord-gcc-switches -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
>>>>> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64
>>>>> -m80387
>>>>> # -mabm -madx -maes -malign-stringops -mavx -mavx2
>>>>> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero
>>>>> -mcx16
>>>>> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr
>>>>> -mglibc
>>>>> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
>>>>> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf
>>>>> -msha
>>>>> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
>>>>> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt
>>>>> -mxsaves
>>>>>
>>>>> AFTER:
>>>>>
>>>>> # GGC heuristics: --param ggc-min-expand=30 --param
>>>>> ggc-min-heapsize=4096
>>>>> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx
>>>>> -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe
>>>>> -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4
>>>>> -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm
>>>>> -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd
>>>>> -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt
>>>>> -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf
>>>>> -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq
>>>>> -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
>>>>> -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero
>>>>> -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2
>>>>> -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg
>>>>> -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite
>>>>> -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect
>>>>> --param=l1-cache-size=32 --param=l1-cache-line-size=64
>>>>> --param=l2-cache-size=512 -mtune=znver1 -g
>>>>>
>>>>> That's the biggest change I made, but I hope it's acceptable.
>>>>> Apart from that the patch simplifies and unifies places where
>>>>> save_decoded_options
>>>>> options are transformed back to string representation.
>>>>>
>>>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>>>
>>>>> Ready to be installed in next stage1?
>>>>> Thanks,
>>>>> Martin
>>>>
>>>
>>
Richard Biener Nov. 23, 2020, 11 a.m. UTC | #21
On Mon, Nov 23, 2020 at 10:00 AM Martin Liška <mliska@suse.cz> wrote:
>
> On 11/20/20 10:49 AM, Richard Biener wrote:
> > On Fri, Apr 3, 2020 at 8:15 PM Egeyar Bagcioglu
> > <egeyar.bagcioglu@oracle.com> wrote:
> >>
> >>
> >>
> >> On 3/18/20 10:05 AM, Martin Liška wrote:
> >>> On 3/17/20 7:43 PM, Egeyar Bagcioglu wrote:
> >>>> Hi Martin,
> >>>>
> >>>> I like the patch. It definitely serves our purposes at Oracle and
> >>>> provides another way to do what my previous patches did as well.
> >>>>
> >>>> 1) It keeps the backwards compatibility regarding
> >>>> -frecord-gcc-switches; therefore, removes my related doubts about
> >>>> your previous patch.
> >>>>
> >>>> 2) It still makes use of -frecord-gcc-switches. The new option is
> >>>> only to control the format. This addresses some previous objections
> >>>> to having a new option doing something similar. Now the new option
> >>>> controls the behaviour of the existing one and that behaviour can be
> >>>> further extended.
> >>>>
> >>>> 3) It uses an environment variable as Jakub suggested.
> >>>>
> >>>> The patch looks good and I confirm that it works for our purposes.
> >>>
> >>> Hello.
> >>>
> >>> Thank you for the support.
> >>>
> >>>>
> >>>> Having said that, I have to ask for recognition in this patch for my
> >>>> and my company's contributions. Can you please keep my name and my
> >>>> work email in the changelog and in the commit message?
> >>>
> >>> Sure, sorry I forgot.
> >>
> >> Hi Martin,
> >>
> >> I noticed that some comments in the patch were still referring to
> >> --record-gcc-command-line, the option I suggested earlier. I updated
> >> those comments to mention -frecord-gcc-switches-format instead and also
> >> added my name to the patch as you agreed above. I attached the updated
> >> patch. We are starting to use this patch in the specific domain where we
> >> need its functionality.
> >
> > So while I like the addition of -frecord-gcc-switches-format to preserve
> > backward compatibility there are IMHO several issues with the patch.
>
> Hey.
>
> >
> > For one, the target hook change to a void(void) hook makes it need to
> > duplicate too much internals.  Please make it take a const char *
> > argument, the actual text to output.
>
> Agree with that, nice improvement.
>
> >
> > For second, I see no good reason to have different handling of
> > -grecord-gcc-switches vs. -frecord-gcc-switches - they should
> > produce the same content and thus -frecord-gcc-switches-format
> > should apply to -grecord-gcc-switches as well.
>
> They do. Both respect the newly added -frecord-gcc-switches-format argument.
>
> >
> > Now - I think what we output into the assembly file with -fverbose-asm
> > should _always_ be the processed arguments since the assembly
> > is produced by cc1, not gcc.
>
> All right, changed that.
>
> >
> > +/* Return value of env variable GCC_DRIVER_COMMAND_LINE if exists.
> > +   Otherwise return empty string.  */
> > +
> > +const char *
> > +get_driver_command_line ()
> > +{
> > +  const char *cmdline = getenv ("GCC_DRIVER_COMMAND_LINE");
> > +  return cmdline != NULL ? cmdline : "";
> > +}
> >
> > I think silently emitting nothing is not a good idea.  In particular using
> > the environment to carry the driver command-line makes it difficult
> > to reproduce output with pasting commands as dumped by -v [-save-temps].
> > Likewise the driver seems to always populate GCC_DRIVER_COMMAND_LINE
> > even if not needed - why not look for -frecord-gcc-switches-format before
> > doing so?  I'd make -frecord-gcc-switches-format a driver only option
> > (only the driver can do sth about it) and amend -frecord-gcc-switches
> > with a -frecord-gcc-switches=FILE variant specifying the content.  The
> > driver would then substitute -frecord-gcc-switches-format=driver
> > with -frecord-gcc-switches=tempfile and dump the command line into
> > tempfile.  cc1 can then pick contents from tempfile or use the processed
> > variant if no contents are specified.
>
> I've just rewritten that to -frecord-gcc-switches-file option. Note that
> we can't transform that to -frecord-gcc-switches=FILE as one can use:
>
> -g frecord-gcc-switches-format=driver and so -frecord-gcc-switches is off.

But the driver can check whether -frecord-gcc-switches is on with
sth like %{frecord-gcc-switches:%{frecord-gcc-switches-format=driver:-frecord-gcc-switches=%b}}
or so.  But I don't mind a separate -frecord-gcc-switches-file option.
Guess we need it anyway since -g implies -grecord-gcc-switchs and that
needs the info as well.

> Thoughts on the new version of the patch?

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?

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.

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.

Richard.

> Thanks,
> Martin
>
> >
> > Richard.
> >
> >
> >> Regards
> >> Egeyar
> >>
> >>
> >>>
> >>> Martin
> >>>
> >>>>
> >>>> Thanks
> >>>> Egeyar
> >>>>
> >>>>
> >>>>
> >>>> On 3/17/20 2:53 PM, Martin Liška wrote:
> >>>>> Hi.
> >>>>>
> >>>>> I'm sending enhanced patch that makes the following changes:
> >>>>> - a new option -frecord-gcc-switches-format is added; the option
> >>>>>    selects format (processed, driver) for all options that record
> >>>>>    GCC command line
> >>>>> - Dwarf gen_produce_string is now used in -fverbose-asm
> >>>>> - The .s file is affected in the following way:
> >>>>>
> >>>>> BEFORE:
> >>>>>
> >>>>> # GNU C17 (SUSE Linux) version 9.2.1 20200128 [revision
> >>>>> 83f65674e78d97d27537361de1a9d74067ff228d] (x86_64-suse-linux)
> >>>>> #    compiled by GNU C version 9.2.1 20200128 [revision
> >>>>> 83f65674e78d97d27537361de1a9d74067ff228d], GMP version 6.2.0, MPFR
> >>>>> version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP
> >>>>>
> >>>>> # GGC heuristics: --param ggc-min-expand=100 --param
> >>>>> ggc-min-heapsize=131072
> >>>>> # options passed:  -fpreprocessed test.i -march=znver1 -mmmx -mno-3dnow
> >>>>> # -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe -maes -msha
> >>>>> # -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi
> >>>>> -mno-sgx
> >>>>> # -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm -mavx -mavx2 -msse4.2
> >>>>> -msse4.1
> >>>>> # -mlzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw
> >>>>> # -madx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er
> >>>>> -mno-avx512cd
> >>>>> # -mno-avx512pf -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves
> >>>>> # -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma
> >>>>> -mno-avx512vbmi
> >>>>> # -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero
> >>>>> -mno-pku
> >>>>> # -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2 -mno-avx512vnni
> >>>>> # -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg -mno-movdiri
> >>>>> -mno-movdir64b
> >>>>> # -mno-waitpkg -mno-cldemote -mno-ptwrite --param l1-cache-size=32
> >>>>> # --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver1
> >>>>> # -grecord-gcc-switches -g -fverbose-asm -frecord-gcc-switches
> >>>>> # options enabled:  -faggressive-loop-optimizations -fassume-phsa
> >>>>> # -fasynchronous-unwind-tables -fauto-inc-dec -fcommon
> >>>>> # -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
> >>>>> # -feliminate-unused-debug-types -ffp-int-builtin-inexact
> >>>>> -ffunction-cse
> >>>>> # -fgcse-lm -fgnu-runtime -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 -flto-odr-type-merging
> >>>>> -fmath-errno
> >>>>> # -fmerge-debug-strings -fpeephole -fplt -fprefetch-loop-arrays
> >>>>> # -frecord-gcc-switches -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
> >>>>> # -fverbose-asm -fzero-initialized-in-bss -m128bit-long-double -m64
> >>>>> -m80387
> >>>>> # -mabm -madx -maes -malign-stringops -mavx -mavx2
> >>>>> # -mavx256-split-unaligned-store -mbmi -mbmi2 -mclflushopt -mclzero
> >>>>> -mcx16
> >>>>> # -mf16c -mfancy-math-387 -mfma -mfp-ret-in-387 -mfsgsbase -mfxsr
> >>>>> -mglibc
> >>>>> # -mieee-fp -mlong-double-80 -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul
> >>>>> # -mpopcnt -mprfchw -mpush-args -mrdrnd -mrdseed -mred-zone -msahf
> >>>>> -msha
> >>>>> # -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mssse3 -mstv
> >>>>> # -mtls-direct-seg-refs -mvzeroupper -mxsave -mxsavec -mxsaveopt
> >>>>> -mxsaves
> >>>>>
> >>>>> AFTER:
> >>>>>
> >>>>> # GGC heuristics: --param ggc-min-expand=30 --param
> >>>>> ggc-min-heapsize=4096
> >>>>> # GNU C17 10.0.1 20200317 (experimental) -march=znver1 -mmmx
> >>>>> -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe
> >>>>> -maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4
> >>>>> -mno-xop -mbmi -mno-sgx -mbmi2 -mno-pconfig -mno-wbnoinvd -mno-tbm
> >>>>> -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm -mno-hle -mrdrnd
> >>>>> -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave -mxsaveopt
> >>>>> -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf
> >>>>> -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq
> >>>>> -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi
> >>>>> -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mmwaitx -mclzero
> >>>>> -mno-pku -mno-rdpid -mno-gfni -mno-shstk -mno-avx512vbmi2
> >>>>> -mno-avx512vnni -mno-vaes -mno-vpclmulqdq -mno-avx512bitalg
> >>>>> -mno-movdiri -mno-movdir64b -mno-waitpkg -mno-cldemote -mno-ptwrite
> >>>>> -mno-avx512bf16 -mno-enqcmd -mno-avx512vp2intersect
> >>>>> --param=l1-cache-size=32 --param=l1-cache-line-size=64
> >>>>> --param=l2-cache-size=512 -mtune=znver1 -g
> >>>>>
> >>>>> That's the biggest change I made, but I hope it's acceptable.
> >>>>> Apart from that the patch simplifies and unifies places where
> >>>>> save_decoded_options
> >>>>> options are transformed back to string representation.
> >>>>>
> >>>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> >>>>>
> >>>>> Ready to be installed in next stage1?
> >>>>> Thanks,
> >>>>> Martin
> >>>>
> >>>
> >>
>
Martin Liška Nov. 23, 2020, 1:02 p.m. UTC | #22
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?

Thanks,
Martin

> 
> Richard.
Martin Liška Nov. 23, 2020, 2:52 p.m. UTC | #23
On 11/23/20 2:02 PM, Martin Liška wrote:
> May I apply the patch after it finishes regression tests and bootstrap?

It survives testing.

There's the second part which adds -frecord-gcc-switches-format.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Thanks,
Martin
Richard Biener Nov. 25, 2020, 1:48 p.m. UTC | #24
On Mon, Nov 23, 2020 at 2:02 PM Martin Liška <mliska@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
...

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).

Thanks,
Richard.

> Thanks,
> Martin
>
> >
> > Richard.
>
Martin Liška Nov. 26, 2020, 1:55 p.m. UTC | #25
On 11/25/20 2:48 PM, Richard Biener wrote:
> On Mon, Nov 23, 2020 at 2:02 PM Martin Liška <mliska@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.
>>
Martin Liška Dec. 2, 2020, 10:46 a.m. UTC | #26
^PING

On 11/26/20 2:55 PM, Martin Liška wrote:
> On 11/25/20 2:48 PM, Richard Biener wrote:
>> On Mon, Nov 23, 2020 at 2:02 PM Martin Liška <mliska@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.
>>>
>
Richard Biener Dec. 3, 2020, 1:12 p.m. UTC | #27
On Thu, Nov 26, 2020 at 2:55 PM Martin Liška <mliska@suse.cz> wrote:
>
> On 11/25/20 2:48 PM, Richard Biener wrote:
> > On Mon, Nov 23, 2020 at 2:02 PM Martin Liška <mliska@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

I don't think it's important to preserve the 'options enabled' part
since the actual
options printed should allow to reproduce it.  But what's clearly
inferior is that
the options are no longer separated from the version string and the
'options passed:' is missing.

Can we somehow preserve this by making the helper produce separate
strings for the 'GNU C17 11.0 ...' part and the options passed part?  So the
-fverbose-asm and -Q consumer can continue to nicely print the option part?

> >
> > 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.
> >>
>
Martin Liška Dec. 4, 2020, 8:08 a.m. UTC | #28
On 12/3/20 2:12 PM, Richard Biener wrote:
> Can we somehow preserve this by making the helper produce separate
> strings for the 'GNU C17 11.0 ...' part and the options passed part?  So the
> -fverbose-asm and -Q consumer can continue to nicely print the option part?

Yep, good idea. I've just done that and I have:

1) -Q output now:

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
options passed: -dumpbase-ext .c -mtune=generic -march=x86-64 -g -O2

and

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
options passed: ./xgcc -B. -Q -v /home/marxin/Programming/testcases/a.c -c -O2 -fverbose-asm -frecord-gcc-switches-format=driver -g -S

2) For -fverbose-asm:

# GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
# options passed: -dumpbase-ext .c -mtune=generic -march=x86-64 -g -O2

and

# GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
# options passed: -dumpbase-ext .c -mtune=generic -march=x86-64 -g -O2 -frecord-gcc-switches-file=/tmp/ccm3kL7d.cmdline

3) DWARF producer:

     <c>   DW_AT_producer    : (indirect string, offset: 0x97): GNU C17 11.0.0 20201204 (experimental) -dumpbase-ext .c -mtune=generic -march=x86-64 -g -O2

and

     <c>   DW_AT_producer    : (indirect string, offset: 0x27): GNU C17 11.0.0 20201204 (experimental) ./xgcc -B. -Q -v /home/marxin/Programming/testcases/a.c -c -O2 -fverbose-asm -frecord-gcc-switches-format=driver -g

Thoughts?
Thanks,
Martin
Richard Biener Dec. 4, 2020, 9:03 a.m. UTC | #29
On Fri, Dec 4, 2020 at 9:08 AM Martin Liška <mliska@suse.cz> wrote:
>
> On 12/3/20 2:12 PM, Richard Biener wrote:
> > Can we somehow preserve this by making the helper produce separate
> > strings for the 'GNU C17 11.0 ...' part and the options passed part?  So the
> > -fverbose-asm and -Q consumer can continue to nicely print the option part?
>
> Yep, good idea. I've just done that and I have:
>
> 1) -Q output now:
>
> GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
> options passed: -dumpbase-ext .c -mtune=generic -march=x86-64 -g -O2
>
> and
>
> GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
> options passed: ./xgcc -B. -Q -v /home/marxin/Programming/testcases/a.c -c -O2 -fverbose-asm -frecord-gcc-switches-format=driver -g -S
>
> 2) For -fverbose-asm:
>
> # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
> # options passed: -dumpbase-ext .c -mtune=generic -march=x86-64 -g -O2
>
> and
>
> # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
> # options passed: -dumpbase-ext .c -mtune=generic -march=x86-64 -g -O2 -frecord-gcc-switches-file=/tmp/ccm3kL7d.cmdline
>
> 3) DWARF producer:
>
>      <c>   DW_AT_producer    : (indirect string, offset: 0x97): GNU C17 11.0.0 20201204 (experimental) -dumpbase-ext .c -mtune=generic -march=x86-64 -g -O2
>
> and
>
>      <c>   DW_AT_producer    : (indirect string, offset: 0x27): GNU C17 11.0.0 20201204 (experimental) ./xgcc -B. -Q -v /home/marxin/Programming/testcases/a.c -c -O2 -fverbose-asm -frecord-gcc-switches-format=driver -g
>
> Thoughts?

+/* Return a heap allocated producer with command line options.  */
+
+char *gen_command_line_string (cl_decoded_option *options,

char * goes to a separate line

+                              unsigned int options_count)
+{

Otherwise 0001- looks good to me.  As said I'd like to see opinions
from others on the
driver / backend communication for 0002.

Thanks,
Richard.

> Thanks,
> Martin
Martin Liška Dec. 4, 2020, 1:30 p.m. UTC | #30
On 12/4/20 10:03 AM, Richard Biener wrote:
> Otherwise 0001- looks good to me.

Pushed that to master.

> As said I'd like to see opinions
> from others on the
> driver / backend communication for 0002.

To be honest, we moved back to the original implementation which used
a temporary file. There hasn't been any opinion for last 8 months :(

Martin
Jakub Jelinek Dec. 4, 2020, 1:34 p.m. UTC | #31
On Fri, Dec 04, 2020 at 02:30:45PM +0100, Martin Liška wrote:
> On 12/4/20 10:03 AM, Richard Biener wrote:
> > Otherwise 0001- looks good to me.
> 
> Pushed that to master.
> 
> > As said I'd like to see opinions
> > from others on the
> > driver / backend communication for 0002.
> 
> To be honest, we moved back to the original implementation which used
> a temporary file. There hasn't been any opinion for last 8 months :(

Using environment variable rather than a temporary file must be faster.

	Jakub
Richard Biener Dec. 4, 2020, 1:50 p.m. UTC | #32
On Fri, Dec 4, 2020 at 2:35 PM Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Fri, Dec 04, 2020 at 02:30:45PM +0100, Martin Liška wrote:
> > On 12/4/20 10:03 AM, Richard Biener wrote:
> > > Otherwise 0001- looks good to me.
> >
> > Pushed that to master.
> >
> > > As said I'd like to see opinions
> > > from others on the
> > > driver / backend communication for 0002.
> >
> > To be honest, we moved back to the original implementation which used
> > a temporary file. There hasn't been any opinion for last 8 months :(
>
> Using environment variable rather than a temporary file must be faster.

But it's difficult to preserve behavior with -save-temps and execing cc1
as printed which is why I don't like it too much, even if it is "faster".
The environment might also be of limited size and with including
everything (-I... -L...) and always (a defect of the patch) I fear we might
run over its size limits on some host OSs at least.

Richard.

>         Jakub
>
Martin Liška Jan. 6, 2021, 2:21 p.m. UTC | #33
PING

On 12/4/20 2:30 PM, Martin Liška wrote:
> On 12/4/20 10:03 AM, Richard Biener wrote:
>> Otherwise 0001- looks good to me.
> 
> Pushed that to master.
> 
>> As said I'd like to see opinions
>> from others on the
>> driver / backend communication for 0002.
> 
> To be honest, we moved back to the original implementation which used
> a temporary file. There hasn't been any opinion for last 8 months :(
> 
> Martin
Martin Liška Jan. 14, 2021, 9:03 a.m. UTC | #34
PING^2

On 1/6/21 3:21 PM, Martin Liška wrote:
> PING
> 
> On 12/4/20 2:30 PM, Martin Liška wrote:
>> On 12/4/20 10:03 AM, Richard Biener wrote:
>>> Otherwise 0001- looks good to me.
>>
>> Pushed that to master.
>>
>>> As said I'd like to see opinions
>>> from others on the
>>> driver / backend communication for 0002.
>>
>> To be honest, we moved back to the original implementation which used
>> a temporary file. There hasn't been any opinion for last 8 months :(
>>
>> Martin
>
Alexandre Oliva Jan. 15, 2021, 7:14 p.m. UTC | #35
Hello, Martin,

Our testing detected unexpected -dumpbase-ext options making to the
producer string.

I tracked it down to something weird that happened in this patch:

On Dec  4, 2020, Martin Liška <mliska@suse.cz> wrote:

> +++ b/gcc/dwarf2out.c
> -      case OPT_dumpbase:
> -      case OPT_dumpbase_ext:
> -      case OPT_dumpdir:

> +++ b/gcc/opts.c
> +      case OPT_dumpbase:
> +      case OPT_dumpdir:

Assuming you didn't really mean to drop the option, the following patch
restores it to the exclusion list in the refactored gen_producer_string.

Regstrapped on x86_64-linux-gnu, installing as obvious.


drop -dumpbase-ext from producer string

From: Alexandre Oliva <oliva@adacore.com>

The -dumpbase and -dumpdir options are excluded from the producer
string output in debug information, but -dumpbase-ext was not.  This
patch excludes it as well.


for  gcc/ChangeLog

	* opts.c (gen_command_line_string): Exclude -dumpbase-ext.
---
 gcc/opts.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/opts.c b/gcc/opts.c
index 527f0dde70685..437389b3de8e7 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -3284,6 +3284,7 @@ gen_command_line_string (cl_decoded_option *options,
       case OPT_o:
       case OPT_d:
       case OPT_dumpbase:
+      case OPT_dumpbase_ext:
       case OPT_dumpdir:
       case OPT_quiet:
       case OPT_version:
Martin Liška Jan. 18, 2021, 9:03 a.m. UTC | #36
On 1/15/21 8:14 PM, Alexandre Oliva wrote:
> Hello, Martin,
> 
> Our testing detected unexpected -dumpbase-ext options making to the
> producer string.
> 
> I tracked it down to something weird that happened in this patch:
> 
> On Dec  4, 2020, Martin Liška <mliska@suse.cz> wrote:
> 
>> +++ b/gcc/dwarf2out.c
>> -      case OPT_dumpbase:
>> -      case OPT_dumpbase_ext:
>> -      case OPT_dumpdir:
> 
>> +++ b/gcc/opts.c
>> +      case OPT_dumpbase:
>> +      case OPT_dumpdir:
> 
> Assuming you didn't really mean to drop the option, the following patch
> restores it to the exclusion list in the refactored gen_producer_string.

Hello.

Thank you for the fix. Yes, it was not an intentional change from my side.

Martin

> 
> Regstrapped on x86_64-linux-gnu, installing as obvious.
> 
> 
> drop -dumpbase-ext from producer string
> 
> From: Alexandre Oliva <oliva@adacore.com>
> 
> The -dumpbase and -dumpdir options are excluded from the producer
> string output in debug information, but -dumpbase-ext was not.  This
> patch excludes it as well.
> 
> 
> for  gcc/ChangeLog
> 
> 	* opts.c (gen_command_line_string): Exclude -dumpbase-ext.
> ---
>   gcc/opts.c |    1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/gcc/opts.c b/gcc/opts.c
> index 527f0dde70685..437389b3de8e7 100644
> --- a/gcc/opts.c
> +++ b/gcc/opts.c
> @@ -3284,6 +3284,7 @@ gen_command_line_string (cl_decoded_option *options,
>         case OPT_o:
>         case OPT_d:
>         case OPT_dumpbase:
> +      case OPT_dumpbase_ext:
>         case OPT_dumpdir:
>         case OPT_quiet:
>         case OPT_version:
> 
>
Martin Liška Jan. 22, 2021, 1:33 p.m. UTC | #37
PING^3

On 1/14/21 10:03 AM, Martin Liška wrote:
> PING^2
> 
> On 1/6/21 3:21 PM, Martin Liška wrote:
>> PING
>>
>> On 12/4/20 2:30 PM, Martin Liška wrote:
>>> On 12/4/20 10:03 AM, Richard Biener wrote:
>>>> Otherwise 0001- looks good to me.
>>>
>>> Pushed that to master.
>>>
>>>> As said I'd like to see opinions
>>>> from others on the
>>>> driver / backend communication for 0002.
>>>
>>> To be honest, we moved back to the original implementation which used
>>> a temporary file. There hasn't been any opinion for last 8 months :(
>>>
>>> Martin
>>
>
Martin Liška Jan. 29, 2021, 1:35 p.m. UTC | #38
PING^4

On 1/22/21 2:33 PM, Martin Liška wrote:
> PING^3
> 
> On 1/14/21 10:03 AM, Martin Liška wrote:
>> PING^2
>>
>> On 1/6/21 3:21 PM, Martin Liška wrote:
>>> PING
>>>
>>> On 12/4/20 2:30 PM, Martin Liška wrote:
>>>> On 12/4/20 10:03 AM, Richard Biener wrote:
>>>>> Otherwise 0001- looks good to me.
>>>>
>>>> Pushed that to master.
>>>>
>>>>> As said I'd like to see opinions
>>>>> from others on the
>>>>> driver / backend communication for 0002.
>>>>
>>>> To be honest, we moved back to the original implementation which used
>>>> a temporary file. There hasn't been any opinion for last 8 months :(
>>>>
>>>> Martin
>>>
>>
>
diff mbox series

Patch

From a6514e12007a8cffa1a6a060196b28c5ada131c3 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 5 Mar 2020 09:39:17 +0100
Subject: [PATCH] Change semantics of -frecord-gcc-switches and add
 -frecord-gcc-switches-format.

gcc/ChangeLog:

2020-03-17  Martin Liska  <mliska@suse.cz>

	* common.opt: Add new option -frecord-gcc-switches-format.
	* doc/invoke.texi: Document the new option.
	* doc/tm.texi: Remove print_switch_type documentation
	entry.
	* dwarf2out.c (gen_producer_string): Move to varasm.c
	and ignore also OPT_frecord_gcc_switches and
	OPT_frecord_gcc_switches_format_.
	(dwarf2out_early_finish): Print corresponding producer format string.
	* flag-types.h (enum record_gcc_switches_format):
	* gcc.c (set_driver_command_line_envvar): New function.
	(driver_handle_option): Always save command line options.
	(driver::main): Save command line.
	(driver::set_commandline): New.
	* gcc.h (driver::set_commandline): New.
	* opts.c (get_producer_string): Moved from dwarf2out.c.
	(get_driver_command_line): New function.
	* opts.h (get_producer_string): New.
	(get_driver_command_line): Likewise.
	* target.def: Remove documentation foor print_switch_type.
	* target.h (enum print_switch_type):  Remove.
	(elf_record_gcc_switches): Change to void type.
	* toplev.c (MAX_LINE): Remove.
	(print_to_asm_out_file): Remove.
	(print_to_stderr): Remove.
	(print_single_switch): Likewise.
	(print_switch_values): Likewise.
	(init_asm_output): Call directly record_gcc_switches.
	(process_options): Print options to stderr.
	* varasm.c (elf_record_gcc_switches): Support
	new flag_record_gcc_switches_format option.
---
 gcc/common.opt      |  15 +++-
 gcc/doc/invoke.texi |  23 +++++-
 gcc/doc/tm.texi     |  37 +--------
 gcc/dwarf2out.c     | 125 ++++--------------------------
 gcc/flag-types.h    |   7 ++
 gcc/gcc.c           |  39 ++++++++++
 gcc/gcc.h           |   1 +
 gcc/opts.c          | 121 +++++++++++++++++++++++++++++
 gcc/opts.h          |   6 ++
 gcc/target.def      |  37 +--------
 gcc/target.h        |  14 +---
 gcc/toplev.c        | 180 +++++---------------------------------------
 gcc/varasm.c        |  59 ++++++---------
 13 files changed, 270 insertions(+), 394 deletions(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index 4368910cb54..7809c734ee1 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2246,9 +2246,22 @@  Common Joined RejectNegative Var(common_deferred_options) Defer
 ; records information in the assembler output file as comments, so
 ; they never reach the object file.
 frecord-gcc-switches
-Common Report Var(flag_record_gcc_switches)
+Common Driver Report Var(flag_record_gcc_switches)
 Record gcc command line switches in the object file.
 
+Enum
+Name(record_gcc_switches_format) Type(enum record_gcc_switches_format)
+
+EnumValue
+Enum(record_gcc_switches_format) String(processed) Value(RECORD_GCC_SWITCHES_PROCESSED)
+
+EnumValue
+Enum(record_gcc_switches_format) String(driver) Value(RECORD_GCC_SWITCHES_DRIVER)
+
+frecord-gcc-switches-format=
+Common Report Joined RejectNegative Var(flag_record_gcc_switches_format) Enum(record_gcc_switches_format) Init(RECORD_GCC_SWITCHES_PROCESSED)
+-frecord-gcc-switches-format=[processed|driver]	Format of recorded gcc command line switches.
+
 freg-struct-return
 Common Report Var(flag_pcc_struct_return,0) Optimization
 Return small aggregates in registers.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 96a95162696..7925990e320 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -622,7 +622,7 @@  Objective-C and Objective-C++ Dialects}.
 -finhibit-size-directive  -fcommon  -fno-ident @gol
 -fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt @gol
 -fno-jump-tables @gol
--frecord-gcc-switches @gol
+-frecord-gcc-switches -frecord-gcc-switches-format @gol
 -freg-struct-return  -fshort-enums  -fshort-wchar @gol
 -fverbose-asm  -fpack-struct[=@var{n}]  @gol
 -fleading-underscore  -ftls-model=@var{model} @gol
@@ -15070,6 +15070,27 @@  comments, so it never reaches the object file.
 See also @option{-grecord-gcc-switches} for another
 way of storing compiler options into the object file.
 
+@item -frecord-gcc-switches-format=@var{format}
+@opindex frecord-gcc-switches-format
+This switch controls the output format of options that record
+the command line.  The affected options are @option{-frecord-gcc-switches},
+@option{-grecord-gcc-switches} and @option{-fverbose-asm}.
+
+The @var{format} argument should be one of the following:
+
+@table @samp
+
+@item processed
+
+Options are printed after processing by the compiler driver.
+It is the default option value.
+
+@item driver
+
+Options are printed as provided to the compiler driver.
+
+@end table
+
 @item -fpic
 @opindex fpic
 @cindex global offset table
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 3560cfae74f..56d493eed21 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -8061,43 +8061,10 @@  need to override this if your target has special flags that might be
 set via @code{__attribute__}.
 @end deftypefn
 
-@deftypefn {Target Hook} int TARGET_ASM_RECORD_GCC_SWITCHES (print_switch_type @var{type}, const char *@var{text})
+@deftypefn {Target Hook} void TARGET_ASM_RECORD_GCC_SWITCHES (void)
 Provides the target with the ability to record the gcc command line
 switches that have been passed to the compiler, and options that are
-enabled.  The @var{type} argument specifies what is being recorded.
-It can take the following values:
-
-@table @gcctabopt
-@item SWITCH_TYPE_PASSED
-@var{text} is a command line switch that has been set by the user.
-
-@item SWITCH_TYPE_ENABLED
-@var{text} is an option which has been enabled.  This might be as a
-direct result of a command line switch, or because it is enabled by
-default or because it has been enabled as a side effect of a different
-command line switch.  For example, the @option{-O2} switch enables
-various different individual optimization passes.
-
-@item SWITCH_TYPE_DESCRIPTIVE
-@var{text} is either NULL or some descriptive text which should be
-ignored.  If @var{text} is NULL then it is being used to warn the
-target hook that either recording is starting or ending.  The first
-time @var{type} is SWITCH_TYPE_DESCRIPTIVE and @var{text} is NULL, the
-warning is for start up and the second time the warning is for
-wind down.  This feature is to allow the target hook to make any
-necessary preparations before it starts to record switches and to
-perform any necessary tidying up after it has finished recording
-switches.
-
-@item SWITCH_TYPE_LINE_START
-This option can be ignored by this target hook.
-
-@item  SWITCH_TYPE_LINE_END
-This option can be ignored by this target hook.
-@end table
-
-The hook's return value must be zero.  Other return values may be
-supported in the future.
+enabled.
 
 By default this hook is set to NULL, but an example implementation is
 provided for ELF based targets.  Called @var{elf_record_gcc_switches},
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index bb45279ea56..2e8ed4e946d 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -24314,116 +24314,6 @@  gen_ptr_to_mbr_type_die (tree type, dw_die_ref context_die)
 
 static char *producer_string;
 
-/* Return a heap allocated producer string including command line options
-   if -grecord-gcc-switches.  */
-
-static char *
-gen_producer_string (void)
-{
-  size_t j;
-  auto_vec<const char *> switches;
-  const char *language_string = lang_hooks.name;
-  char *producer, *tail;
-  const char *p;
-  size_t len = dwarf_record_gcc_switches ? 0 : 3;
-  size_t plen = strlen (language_string) + 1 + strlen (version_string);
-
-  for (j = 1; dwarf_record_gcc_switches && j < save_decoded_options_count; j++)
-    switch (save_decoded_options[j].opt_index)
-      {
-      case OPT_o:
-      case OPT_d:
-      case OPT_dumpbase:
-      case OPT_dumpdir:
-      case OPT_auxbase:
-      case OPT_auxbase_strip:
-      case OPT_quiet:
-      case OPT_version:
-      case OPT_v:
-      case OPT_w:
-      case OPT_L:
-      case OPT_D:
-      case OPT_I:
-      case OPT_U:
-      case OPT_SPECIAL_unknown:
-      case OPT_SPECIAL_ignore:
-      case OPT_SPECIAL_warn_removed:
-      case OPT_SPECIAL_program_name:
-      case OPT_SPECIAL_input_file:
-      case OPT_grecord_gcc_switches:
-      case OPT__output_pch_:
-      case OPT_fdiagnostics_show_location_:
-      case OPT_fdiagnostics_show_option:
-      case OPT_fdiagnostics_show_caret:
-      case OPT_fdiagnostics_show_labels:
-      case OPT_fdiagnostics_show_line_numbers:
-      case OPT_fdiagnostics_color_:
-      case OPT_fdiagnostics_format_:
-      case OPT_fverbose_asm:
-      case OPT____:
-      case OPT__sysroot_:
-      case OPT_nostdinc:
-      case OPT_nostdinc__:
-      case OPT_fpreprocessed:
-      case OPT_fltrans_output_list_:
-      case OPT_fresolution_:
-      case OPT_fdebug_prefix_map_:
-      case OPT_fmacro_prefix_map_:
-      case OPT_ffile_prefix_map_:
-      case OPT_fcompare_debug:
-      case OPT_fchecking:
-      case OPT_fchecking_:
-	/* Ignore these.  */
-	continue;
-      case OPT_flto_:
-	{
-	  const char *lto_canonical = "-flto";
-	  switches.safe_push (lto_canonical);
-	  len += strlen (lto_canonical) + 1;
-	  break;
-	}
-      default:
-        if (cl_options[save_decoded_options[j].opt_index].flags
-	    & CL_NO_DWARF_RECORD)
-	  continue;
-        gcc_checking_assert (save_decoded_options[j].canonical_option[0][0]
-			     == '-');
-        switch (save_decoded_options[j].canonical_option[0][1])
-	  {
-	  case 'M':
-	  case 'i':
-	  case 'W':
-	    continue;
-	  case 'f':
-	    if (strncmp (save_decoded_options[j].canonical_option[0] + 2,
-			 "dump", 4) == 0)
-	      continue;
-	    break;
-	  default:
-	    break;
-	  }
-	switches.safe_push (save_decoded_options[j].orig_option_with_args_text);
-	len += strlen (save_decoded_options[j].orig_option_with_args_text) + 1;
-	break;
-      }
-
-  producer = XNEWVEC (char, plen + 1 + len + 1);
-  tail = producer;
-  sprintf (tail, "%s %s", language_string, version_string);
-  tail += plen;
-
-  FOR_EACH_VEC_ELT (switches, j, p)
-    {
-      len = strlen (p);
-      *tail = ' ';
-      memcpy (tail + 1, p, len);
-      tail += len + 1;
-    }
-
-  *tail = '\0';
-  return producer;
-}
-
 /* Given a C and/or C++ language/version string return the "highest".
    C++ is assumed to be "higher" than C in this case.  Used for merging
    LTO translation unit languages.  */
@@ -31986,7 +31876,20 @@  dwarf2out_early_finish (const char *filename)
      header compilation, so always fill it with empty string initially
      and overwrite only here.  */
   dw_attr_node *producer = get_AT (comp_unit_die (), DW_AT_producer);
-  producer_string = gen_producer_string ();
+  producer_string = concat (lang_hooks.name, " ", version_string, NULL);
+
+  if (dwarf_record_gcc_switches)
+    {
+      char *producer_string_old = producer_string;
+      if (flag_record_gcc_switches_format == RECORD_GCC_SWITCHES_DRIVER)
+	producer_string = concat (producer_string, " ",
+				  get_driver_command_line (), NULL);
+      else
+	producer_string = get_producer_string (lang_hooks.name,
+					       save_decoded_options,
+					       save_decoded_options_count);
+      free (producer_string_old);
+    }
   producer->dw_attr_val.v.val_str->refcount--;
   producer->dw_attr_val.v.val_str = find_AT_string (producer_string);
 
diff --git a/gcc/flag-types.h b/gcc/flag-types.h
index b092c563f3d..20ff86e2af5 100644
--- a/gcc/flag-types.h
+++ b/gcc/flag-types.h
@@ -381,4 +381,11 @@  enum parloops_schedule_type
   PARLOOPS_SCHEDULE_RUNTIME
 };
 
+/* Record GCC options type.  */
+enum record_gcc_switches_format
+{
+  RECORD_GCC_SWITCHES_PROCESSED = 0,
+  RECORD_GCC_SWITCHES_DRIVER
+};
+
 #endif /* ! GCC_FLAG_TYPES_H */
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 9f790db0daf..b4315750079 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -235,6 +235,11 @@  static int verbose_only_flag;
 
 static int print_subprocess_help;
 
+/* argc and argv used to call gcc.  Necessary for
+   --record-gcc-command-line option.  */
+static unsigned int driver_gcc_argc;
+static const char **driver_gcc_argv;
+
 /* Linker suffix passed to -fuse-ld=... */
 static const char *use_ld;
 
@@ -3724,6 +3729,28 @@  set_source_date_epoch_envvar ()
   setenv ("SOURCE_DATE_EPOCH", source_date_epoch, 0);
 }
 
+/* Set GCC_DRIVER_COMMAND_LINE enviromental variable that is later
+   used by -frecord-gcc-switches option.  */
+
+static void
+set_driver_command_line_envvar ()
+{
+  unsigned int length = 0;
+  for (unsigned int i = 0; i < driver_gcc_argc; i++)
+    length += strlen (driver_gcc_argv[i]) + 1;
+
+  char *buffer = (char *)xmalloc (length);
+  char *ptr = buffer;
+  for (unsigned int i = 0; i < driver_gcc_argc; i++)
+    {
+      unsigned l = sprintf (ptr, i == 0 ? "%s" : " %s", driver_gcc_argv[i]);
+      ptr += l;
+    }
+
+  setenv ("GCC_DRIVER_COMMAND_LINE", buffer, 0);
+  free (buffer);
+}
+
 /* Handle an option DECODED that is unknown to the option-processing
    machinery.  */
 
@@ -4296,6 +4323,8 @@  driver_handle_option (struct gcc_options *opts,
       break;
     }
 
+  set_driver_command_line_envvar ();
+
   if (do_save)
     save_switch (decoded->canonical_option[0],
 		 decoded->canonical_option_num_elements - 1,
@@ -7387,6 +7416,7 @@  driver::main (int argc, char **argv)
 
   set_progname (argv[0]);
   expand_at_files (&argc, &argv);
+  set_commandline (argc, const_cast <const char **> (argv));
   decode_argv (argc, const_cast <const char **> (argv));
   global_initializations ();
   build_multilib_strings ();
@@ -7430,6 +7460,15 @@  driver::set_progname (const char *argv0) const
   xmalloc_set_program_name (progname);
 }
 
+/* Keep command line for --record-gcc-command-line.  */
+
+void
+driver::set_commandline (int argc, const char **argv) const
+{
+  driver_gcc_argc = argc;
+  driver_gcc_argv = argv;
+}
+
 /* Expand any @ files within the command-line args,
    setting at_file_supplied if any were expanded.  */
 
diff --git a/gcc/gcc.h b/gcc/gcc.h
index 70d8f08f059..cde77fbaad7 100644
--- a/gcc/gcc.h
+++ b/gcc/gcc.h
@@ -37,6 +37,7 @@  class driver
 
  private:
   void set_progname (const char *argv0) const;
+  void set_commandline (int argc, const char **argv) const;
   void expand_at_files (int *argc, char ***argv) const;
   void decode_argv (int argc, const char **argv);
   void global_initializations ();
diff --git a/gcc/opts.c b/gcc/opts.c
index ac160ed8404..e5ec6bef62a 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -32,6 +32,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "spellcheck.h"
 #include "opt-suggestions.h"
 #include "diagnostic-color.h"
+#include "version.h"
 
 static void set_Wstrict_aliasing (struct gcc_options *opts, int onoff);
 
@@ -3132,3 +3133,123 @@  get_option_url (diagnostic_context *, int option_index)
   else
     return NULL;
 }
+
+/* Return a heap allocated producer string including command line options.  */
+
+char *
+get_producer_string (const char *language_string, cl_decoded_option *options,
+		     unsigned int options_count)
+{
+  size_t j;
+  auto_vec<const char *> switches;
+  char *producer, *tail;
+  const char *p;
+  size_t len = 0;
+  size_t plen = strlen (language_string) + 1 + strlen (version_string);
+
+  for (j = 0; j < options_count; j++)
+    switch (options[j].opt_index)
+      {
+      case OPT_o:
+      case OPT_d:
+      case OPT_dumpbase:
+      case OPT_dumpdir:
+      case OPT_auxbase:
+      case OPT_auxbase_strip:
+      case OPT_quiet:
+      case OPT_version:
+      case OPT_v:
+      case OPT_w:
+      case OPT_L:
+      case OPT_D:
+      case OPT_I:
+      case OPT_U:
+      case OPT_SPECIAL_unknown:
+      case OPT_SPECIAL_ignore:
+      case OPT_SPECIAL_warn_removed:
+      case OPT_SPECIAL_program_name:
+      case OPT_SPECIAL_input_file:
+      case OPT_grecord_gcc_switches:
+      case OPT_frecord_gcc_switches:
+      case OPT_frecord_gcc_switches_format_:
+      case OPT__output_pch_:
+      case OPT_fdiagnostics_show_location_:
+      case OPT_fdiagnostics_show_option:
+      case OPT_fdiagnostics_show_caret:
+      case OPT_fdiagnostics_show_labels:
+      case OPT_fdiagnostics_show_line_numbers:
+      case OPT_fdiagnostics_color_:
+      case OPT_fdiagnostics_format_:
+      case OPT_fverbose_asm:
+      case OPT____:
+      case OPT__sysroot_:
+      case OPT_nostdinc:
+      case OPT_nostdinc__:
+      case OPT_fpreprocessed:
+      case OPT_fltrans_output_list_:
+      case OPT_fresolution_:
+      case OPT_fdebug_prefix_map_:
+      case OPT_fmacro_prefix_map_:
+      case OPT_ffile_prefix_map_:
+      case OPT_fcompare_debug:
+      case OPT_fchecking:
+      case OPT_fchecking_:
+	/* Ignore these.  */
+	continue;
+      case OPT_flto_:
+	{
+	  const char *lto_canonical = "-flto";
+	  switches.safe_push (lto_canonical);
+	  len += strlen (lto_canonical) + 1;
+	  break;
+	}
+      default:
+	if (cl_options[options[j].opt_index].flags
+	    & CL_NO_DWARF_RECORD)
+	  continue;
+	gcc_checking_assert (options[j].canonical_option[0][0] == '-');
+	switch (options[j].canonical_option[0][1])
+	  {
+	  case 'M':
+	  case 'i':
+	  case 'W':
+	    continue;
+	  case 'f':
+	    if (strncmp (options[j].canonical_option[0] + 2,
+			 "dump", 4) == 0)
+	      continue;
+	    break;
+	  default:
+	    break;
+	  }
+	switches.safe_push (options[j].orig_option_with_args_text);
+	len += strlen (options[j].orig_option_with_args_text) + 1;
+	break;
+      }
+
+  producer = XNEWVEC (char, plen + 1 + len + 1);
+  tail = producer;
+  sprintf (tail, "%s %s", language_string, version_string);
+  tail += plen;
+
+  FOR_EACH_VEC_ELT (switches, j, p)
+    {
+      len = strlen (p);
+      *tail = ' ';
+      memcpy (tail + 1, p, len);
+      tail += len + 1;
+    }
+
+  *tail = '\0';
+  return producer;
+}
+
+/* Return value of env variable GCC_DRIVER_COMMAND_LINE if exists.
+   Otherwise return empty string.  */
+
+const char *
+get_driver_command_line ()
+{
+  const char *cmdline = getenv ("GCC_DRIVER_COMMAND_LINE");
+  return cmdline != NULL ? cmdline : "";
+}
diff --git a/gcc/opts.h b/gcc/opts.h
index 8f594b46e33..fc3cd4b4596 100644
--- a/gcc/opts.h
+++ b/gcc/opts.h
@@ -465,6 +465,12 @@  extern void parse_options_from_collect_gcc_options (const char *, obstack *,
 
 extern void prepend_xassembler_to_collect_as_options (const char *, obstack *);
 
+extern char *get_producer_string (const char *language_string,
+				  cl_decoded_option *options,
+				  unsigned int options_count);
+
+extern const char *get_driver_command_line ();
+
 /* Set OPTION in OPTS to VALUE if the option is not set in OPTS_SET.  */
 
 #define SET_OPTION_IF_UNSET(OPTS, OPTS_SET, OPTION, VALUE) \
diff --git a/gcc/target.def b/gcc/target.def
index b5e82ff826e..9cb9dab60ab 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -746,40 +746,7 @@  DEFHOOK
 (record_gcc_switches,
  "Provides the target with the ability to record the gcc command line\n\
 switches that have been passed to the compiler, and options that are\n\
-enabled.  The @var{type} argument specifies what is being recorded.\n\
-It can take the following values:\n\
-\n\
-@table @gcctabopt\n\
-@item SWITCH_TYPE_PASSED\n\
-@var{text} is a command line switch that has been set by the user.\n\
-\n\
-@item SWITCH_TYPE_ENABLED\n\
-@var{text} is an option which has been enabled.  This might be as a\n\
-direct result of a command line switch, or because it is enabled by\n\
-default or because it has been enabled as a side effect of a different\n\
-command line switch.  For example, the @option{-O2} switch enables\n\
-various different individual optimization passes.\n\
-\n\
-@item SWITCH_TYPE_DESCRIPTIVE\n\
-@var{text} is either NULL or some descriptive text which should be\n\
-ignored.  If @var{text} is NULL then it is being used to warn the\n\
-target hook that either recording is starting or ending.  The first\n\
-time @var{type} is SWITCH_TYPE_DESCRIPTIVE and @var{text} is NULL, the\n\
-warning is for start up and the second time the warning is for\n\
-wind down.  This feature is to allow the target hook to make any\n\
-necessary preparations before it starts to record switches and to\n\
-perform any necessary tidying up after it has finished recording\n\
-switches.\n\
-\n\
-@item SWITCH_TYPE_LINE_START\n\
-This option can be ignored by this target hook.\n\
-\n\
-@item  SWITCH_TYPE_LINE_END\n\
-This option can be ignored by this target hook.\n\
-@end table\n\
-\n\
-The hook's return value must be zero.  Other return values may be\n\
-supported in the future.\n\
+enabled.\n\
 \n\
 By default this hook is set to NULL, but an example implementation is\n\
 provided for ELF based targets.  Called @var{elf_record_gcc_switches},\n\
@@ -787,7 +754,7 @@  it records the switches as ASCII text inside a new, string mergeable\n\
 section in the assembler output file.  The name of the new section is\n\
 provided by the @code{TARGET_ASM_RECORD_GCC_SWITCHES_SECTION} target\n\
 hook.",
- int, (print_switch_type type, const char *text),
+ void, (void),
  NULL)
 
 /* The name of the section that the example ELF implementation of
diff --git a/gcc/target.h b/gcc/target.h
index 2f47c577d00..8421f78915f 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -68,16 +68,6 @@  union cumulative_args_t { void *p; };
 
 #endif /* !CHECKING_P */
 
-/* Types used by the record_gcc_switches() target function.  */
-enum print_switch_type
-{
-  SWITCH_TYPE_PASSED,		/* A switch passed on the command line.  */
-  SWITCH_TYPE_ENABLED,		/* An option that is currently enabled.  */
-  SWITCH_TYPE_DESCRIPTIVE,	/* Descriptive text, not a switch or option.  */
-  SWITCH_TYPE_LINE_START,	/* Please emit any necessary text at the start of a line.  */
-  SWITCH_TYPE_LINE_END		/* Please emit a line terminator.  */
-};
-
 /* Types of memory operation understood by the "by_pieces" infrastructure.
    Used by the TARGET_USE_BY_PIECES_INFRASTRUCTURE_P target hook and
    internally by the functions in expr.c.  */
@@ -96,10 +86,8 @@  extern unsigned HOST_WIDE_INT by_pieces_ninsns (unsigned HOST_WIDE_INT,
 						unsigned int,
 						by_pieces_operation);
 
-typedef int (* print_switch_fn_type) (print_switch_type, const char *);
-
 /* An example implementation for ELF targets.  Defined in varasm.c  */
-extern int elf_record_gcc_switches (print_switch_type type, const char *);
+extern void elf_record_gcc_switches (void);
 
 /* Some places still assume that all pointer or address modes are the
    standard Pmode and ptr_mode.  These optimizations become invalid if
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 4c8be502c71..4128a547ea4 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -114,9 +114,6 @@  static void compile_file (void);
 /* True if we don't need a backend (e.g. preprocessing only).  */
 static bool no_backend;
 
-/* Length of line when printing switch values.  */
-#define MAX_LINE 75
-
 /* Decoded options, and number of such options.  */
 struct cl_decoded_option *save_decoded_options;
 unsigned int save_decoded_options_count;
@@ -684,149 +681,6 @@  print_version (FILE *file, const char *indent, bool show_global_state)
     }
 }
 
-static int
-print_to_asm_out_file (print_switch_type type, const char * text)
-{
-  bool prepend_sep = true;
-
-  switch (type)
-    {
-    case SWITCH_TYPE_LINE_END:
-      putc ('\n', asm_out_file);
-      return 1;
-
-    case SWITCH_TYPE_LINE_START:
-      fputs (ASM_COMMENT_START, asm_out_file);
-      return strlen (ASM_COMMENT_START);
-
-    case SWITCH_TYPE_DESCRIPTIVE:
-      if (ASM_COMMENT_START[0] == 0)
-	prepend_sep = false;
-      /* FALLTHRU */
-    case SWITCH_TYPE_PASSED:
-    case SWITCH_TYPE_ENABLED:
-      if (prepend_sep)
-	fputc (' ', asm_out_file);
-      fputs (text, asm_out_file);
-      /* No need to return the length here as
-	 print_single_switch has already done it.  */
-      return 0;
-
-    default:
-      return -1;
-    }
-}
-
-static int
-print_to_stderr (print_switch_type type, const char * text)
-{
-  switch (type)
-    {
-    case SWITCH_TYPE_LINE_END:
-      putc ('\n', stderr);
-      return 1;
-
-    case SWITCH_TYPE_LINE_START:
-      return 0;
-
-    case SWITCH_TYPE_PASSED:
-    case SWITCH_TYPE_ENABLED:
-      fputc (' ', stderr);
-      /* FALLTHRU */
-
-    case SWITCH_TYPE_DESCRIPTIVE:
-      fputs (text, stderr);
-      /* No need to return the length here as
-	 print_single_switch has already done it.  */
-      return 0;
-
-    default:
-      return -1;
-    }
-}
-
-/* Print an option value and return the adjusted position in the line.
-   ??? print_fn doesn't handle errors, eg disk full; presumably other
-   code will catch a disk full though.  */
-
-static int
-print_single_switch (print_switch_fn_type print_fn,
-		     int pos,
-		     print_switch_type type,
-		     const char * text)
-{
-  /* The ultrix fprintf returns 0 on success, so compute the result
-     we want here since we need it for the following test.  The +1
-     is for the separator character that will probably be emitted.  */
-  int len = strlen (text) + 1;
-
-  if (pos != 0
-      && pos + len > MAX_LINE)
-    {
-      print_fn (SWITCH_TYPE_LINE_END, NULL);
-      pos = 0;
-    }
-
-  if (pos == 0)
-    pos += print_fn (SWITCH_TYPE_LINE_START, NULL);
-
-  print_fn (type, text);
-  return pos + len;
-}
-
-/* Print active target switches using PRINT_FN.
-   POS is the current cursor position and MAX is the size of a "line".
-   Each line begins with INDENT and ends with TERM.
-   Each switch is separated from the next by SEP.  */
-
-static void
-print_switch_values (print_switch_fn_type print_fn)
-{
-  int pos = 0;
-  size_t j;
-
-  /* Print the options as passed.  */
-  pos = print_single_switch (print_fn, pos,
-			     SWITCH_TYPE_DESCRIPTIVE, _("options passed: "));
-
-  for (j = 1; j < save_decoded_options_count; j++)
-    {
-      switch (save_decoded_options[j].opt_index)
-	{
-	case OPT_o:
-	case OPT_d:
-	case OPT_dumpbase:
-	case OPT_dumpdir:
-	case OPT_auxbase:
-	case OPT_quiet:
-	case OPT_version:
-	  /* Ignore these.  */
-	  continue;
-	}
-
-      pos = print_single_switch (print_fn, pos, SWITCH_TYPE_PASSED,
-				 save_decoded_options[j].orig_option_with_args_text);
-    }
-
-  if (pos > 0)
-    print_fn (SWITCH_TYPE_LINE_END, NULL);
-
-  /* Print the -f and -m options that have been enabled.
-     We don't handle language specific options but printing argv
-     should suffice.  */
-  pos = print_single_switch (print_fn, 0,
-			     SWITCH_TYPE_DESCRIPTIVE, _("options enabled: "));
-
-  unsigned lang_mask = lang_hooks.option_lang_mask ();
-  for (j = 0; j < cl_options_count; j++)
-    if (cl_options[j].cl_report
-	&& option_enabled (j, lang_mask, &global_options) > 0)
-      pos = print_single_switch (print_fn, pos,
-				 SWITCH_TYPE_ENABLED, cl_options[j].opt_text);
-
-  print_fn (SWITCH_TYPE_LINE_END, NULL);
-}
-
 /* Open assembly code output file.  Do this even if -fsyntax-only is
    on, because then the driver will have provided the name of a
    temporary file or bit bucket for us.  NAME is the file specified on
@@ -871,16 +725,7 @@  init_asm_output (const char *name)
       if (flag_record_gcc_switches)
 	{
 	  if (targetm.asm_out.record_gcc_switches)
-	    {
-	      /* Let the target know that we are about to start recording.  */
-	      targetm.asm_out.record_gcc_switches (SWITCH_TYPE_DESCRIPTIVE,
-						   NULL);
-	      /* Now record the switches.  */
-	      print_switch_values (targetm.asm_out.record_gcc_switches);
-	      /* Let the target know that the recording is over.  */
-	      targetm.asm_out.record_gcc_switches (SWITCH_TYPE_DESCRIPTIVE,
-						   NULL);
-	    }
+	    targetm.asm_out.record_gcc_switches ();
 	  else
 	    inform (UNKNOWN_LOCATION,
 		    "%<-frecord-gcc-switches%> is not supported by "
@@ -889,11 +734,16 @@  init_asm_output (const char *name)
 
       if (flag_verbose_asm)
 	{
-	  /* Print the list of switches in effect
-	     into the assembler file as comments.  */
 	  print_version (asm_out_file, ASM_COMMENT_START, true);
-	  print_switch_values (print_to_asm_out_file);
-	  putc ('\n', asm_out_file);
+	  fputs (ASM_COMMENT_START, asm_out_file);
+	  fputc (' ', asm_out_file);
+	  if (flag_record_gcc_switches_format == RECORD_GCC_SWITCHES_DRIVER)
+	    fputs (get_driver_command_line (), asm_out_file);
+	  else
+	    fputs (get_producer_string (lang_hooks.name, save_decoded_options,
+					save_decoded_options_count),
+		   asm_out_file);
+	  fputc ('\n', asm_out_file);
 	}
     }
 }
@@ -1520,8 +1370,14 @@  process_options (void)
   if (version_flag)
     {
       print_version (stderr, "", true);
-      if (! quiet_flag)
-	print_switch_values (print_to_stderr);
+      if (!quiet_flag)
+	{
+	  if (flag_record_gcc_switches_format == RECORD_GCC_SWITCHES_DRIVER)
+	    fputs (get_driver_command_line (), stderr);
+	  else
+	    fputs (get_producer_string (lang_hooks.name, save_decoded_options,
+					save_decoded_options_count), stderr);
+	}
     }
 
   if (flag_syntax_only)
diff --git a/gcc/varasm.c b/gcc/varasm.c
index dc6da6c0b5b..1b23b5f4cc4 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -43,6 +43,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "fold-const.h"
 #include "stor-layout.h"
 #include "varasm.h"
+#include "version.h"
 #include "flags.h"
 #include "stmt.h"
 #include "expr.h"
@@ -57,6 +58,8 @@  along with GCC; see the file COPYING3.  If not see
 #include "asan.h"
 #include "rtl-iter.h"
 #include "file-prefix-map.h" /* remap_debug_filename()  */
+#include "toplev.h"
+#include "opts.h"
 
 #ifdef XCOFF_DEBUGGING_INFO
 #include "xcoffout.h"		/* Needed for external data declarations.  */
@@ -7803,45 +7806,29 @@  output_object_blocks (void)
    we want to emit NUL strings terminators into the object file we have to use
    ASM_OUTPUT_SKIP.  */
 
-int
-elf_record_gcc_switches (print_switch_type type, const char * name)
+void
+elf_record_gcc_switches ()
 {
-  switch (type)
-    {
-    case SWITCH_TYPE_PASSED:
-      ASM_OUTPUT_ASCII (asm_out_file, name, strlen (name));
-      ASM_OUTPUT_SKIP (asm_out_file, HOST_WIDE_INT_1U);
-      break;
-
-    case SWITCH_TYPE_DESCRIPTIVE:
-      if (name == NULL)
-	{
-	  /* Distinguish between invocations where name is NULL.  */
-	  static bool started = false;
-
-	  if (!started)
-	    {
-	      section * sec;
-
-	      sec = get_section (targetm.asm_out.record_gcc_switches_section,
-				 SECTION_DEBUG
-				 | SECTION_MERGE
-				 | SECTION_STRINGS
-				 | (SECTION_ENTSIZE & 1),
-				 NULL);
-	      switch_to_section (sec);
-	      started = true;
-	    }
-	}
+  section *sec = get_section (targetm.asm_out.record_gcc_switches_section,
+			      SECTION_DEBUG | SECTION_MERGE
+			      | SECTION_STRINGS | (SECTION_ENTSIZE & 1), NULL);
+  switch_to_section (sec);
 
-    default:
-      break;
+  if (flag_record_gcc_switches_format == RECORD_GCC_SWITCHES_DRIVER)
+    {
+      ASM_OUTPUT_ASCII (asm_out_file, version_string, strlen (version_string));
+      ASM_OUTPUT_ASCII (asm_out_file, " ", 1);
+      const char *cmdline = get_driver_command_line ();
+      ASM_OUTPUT_ASCII (asm_out_file, cmdline, strlen (cmdline) + 1);
+    }
+  else
+    {
+      const char *producer_string
+	= get_producer_string (lang_hooks.name, save_decoded_options,
+			       save_decoded_options_count);
+      ASM_OUTPUT_ASCII (asm_out_file, producer_string,
+			strlen (producer_string) + 1);
     }
-
-  /* The return value is currently ignored by the caller, but must be 0.
-     For -fverbose-asm the return value would be the number of characters
-     emitted into the assembler file.  */
-  return 0;
 }
 
 /* Emit text to declare externally defined symbols. It is needed to
-- 
2.25.1