You are not logged in.

#1 2011-04-29 20:36:05

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

gcc 4.6.0 seems to have -fomit-frame-pointer disabled in -O2 ?

According to the gcc docs, -fomit-frame-pointer should be enabled at -O2 for x86_64 and i686 with release 4.6.0, but I get the following:

On x86_64 and on i686:

$ gcc -c -Q -O2 --help=optimizers | grep fomit
  -fomit-frame-pointer                [disabled]

Is this the expected behavior?  I don't see anything in the PKGBUILD that would disable it.

"Starting with GCC version 4.6, the default setting (when not optimizing for size) for 32-bit Linux x86 and 32-bit Darwin x86 targets has been changed to -fomit-frame-pointer. The default can be reverted to -fno-omit-frame-pointer by configuring GCC with the --enable-frame-pointer configure option."

And...

-fomit-frame-pointer
    Don't keep the frame pointer in a register for functions that don't need one. This avoids the instructions to save, set up and restore frame pointers; it also makes an extra register available in many functions. It also makes debugging impossible on some machines.

    On some machines, such as the VAX, this flag has no effect, because the standard calling sequence automatically handles the frame pointer and nothing is saved by pretending it doesn't exist. The machine-description macro FRAME_POINTER_REQUIRED controls whether a target machine supports this flag. See Register Usage.

    Starting with GCC version 4.6, the default setting (when not optimizing for size) for 32-bit Linux x86 and 32-bit Darwin x86 targets has been changed to -fomit-frame-pointer. The default can be reverted to -fno-omit-frame-pointer by configuring GCC with the --enable-frame-pointer configure option.

    Enabled at levels -O, -O2, -O3, -Os.

Last edited by graysky (2011-04-29 20:37:32)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2011-04-30 08:00:55

Zom
Member
From: Sweden
Registered: 2007-10-27
Posts: 430

Re: gcc 4.6.0 seems to have -fomit-frame-pointer disabled in -O2 ?

graysky wrote:

According to the gcc docs, -fomit-frame-pointer should be enabled at -O2 for x86_64 and i686 with release 4.6.0, ...

Well, as far as I understand it, it only does so when it doesn't interfere with debugging, and according to the gentoo wiki, it makes debugging on "AMD64" (which is what x86_64 used to be called) "impossible".

Hence:

"Starting with GCC version 4.6, the default setting (when not optimizing for size) for 32-bit Linux x86 and 32-bit Darwin x86 targets has been changed to -fomit-frame-pointer. The default can be reverted to -fno-omit-frame-pointer by configuring GCC with the --enable-frame-pointer configure option."

It's not mentioning 64-bit linux because it'd make debugging quite bothersome. Unless this was somehow fixed in 4.6, I guess it's still the same issue.

For example, see the Safe Cflags for Core i7. -fomit-frame-pointer is present for the 32-bit version but not in the 64-bit version. And this was before GCC-4.6, so it's not implied that it should do that automatically either.

At least, that's what I'm guessing.

Offline

#3 2011-04-30 10:18:52

koeleck
Member
From: Germany
Registered: 2009-04-07
Posts: 4

Re: gcc 4.6.0 seems to have -fomit-frame-pointer disabled in -O2 ?

fomit-frame-pointer is enabled at default with O2 on x86 and x86_64.

You can't trust the output of help={traget,optimizers}.
Try this:

cd /tmp
echo 'int main() {return 0;}' > test.c && gcc -v -Q -march=native -O2 test.c -o test && rm test.c test

You should see fomit-frame-pointer in the 'enabled options'-section

Offline

#4 2011-04-30 10:30:53

sumski
Member
From: Zagreb, Croatia
Registered: 2011-04-30
Posts: 114

Re: gcc 4.6.0 seems to have -fomit-frame-pointer disabled in -O2 ?

This is true on bootstraped Debian Sid (i386 and amd64) using

echo 'int main() {return 0;}' > test.c && gcc -v -Q -march=core2 -O2 test.c -o test && rm test.c test:

and gcc-4.6

options enabled:  -falign-labels -fasynchronous-unwind-tables
 -fauto-inc-dec -fbranch-count-reg -fcaller-saves
 -fcombine-stack-adjustments -fcommon -fcompare-elim -fcprop-registers
 -fcrossjumping -fcse-follow-jumps -fdefer-pop -fdelete-null-pointer-checks
 -fdevirtualize -fdwarf2-cfi-asm -fearly-inlining
 -feliminate-unused-debug-types -fexpensive-optimizations
 -fforward-propagate -ffunction-cse -fgcse -fgcse-lm
 -fguess-branch-probability -fident -fif-conversion -fif-conversion2
 -findirect-inlining -finline -finline-functions-called-once
 -finline-small-functions -fipa-cp -fipa-profile -fipa-pure-const
 -fipa-reference -fipa-sra -fira-share-save-slots -fira-share-spill-slots
 -fivopts -fkeep-static-consts -fleading-underscore -fmath-errno
 -fmerge-constants -fmerge-debug-strings -fmove-loop-invariants
 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls
 -fpartial-inlining -fpcc-struct-return -fpeephole -fpeephole2
 -fprefetch-loop-arrays -fregmove -freorder-blocks -freorder-functions
 -frerun-cse-after-loop -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-insns2
 -fshow-column -fsigned-zeros -fsplit-ivs-in-unroller -fsplit-wide-types
 -fstrict-aliasing -fstrict-overflow -fstrict-volatile-bitfields
 -fthread-jumps -ftoplevel-reorder -ftrapping-math -ftree-bit-ccp
 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop
 -ftree-copyrename -ftree-cselim -ftree-dce -ftree-dominator-opts
 -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-if-convert
 -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize
 -ftree-parallelize-loops= -ftree-phiprop -ftree-pre -ftree-pta
 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slp-vectorize
 -ftree-sra -ftree-switch-conversion -ftree-ter -ftree-vect-loop-version
 -ftree-vrp -funit-at-a-time -funwind-tables -fvar-tracking
 -fvar-tracking-assignments -fvect-cost-model -fzero-initialized-in-bss
 -m32 -m80387 -m96bit-long-double -maccumulate-outgoing-args
 -malign-stringops -mcx16 -mfancy-math-387 -mfp-ret-in-387 -mglibc
 -mieee-fp -mmmx -mno-red-zone -mno-sse4 -mpush-args -msahf -msse -msse2
 -msse3 -mssse3 -mtls-direct-seg-refs

Last edited by sumski (2011-04-30 10:34:52)

Offline

#5 2011-04-30 10:33:14

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: gcc 4.6.0 seems to have -fomit-frame-pointer disabled in -O2 ?

@koeleck - nice, thanks!

1) Why can't we trust the output of help={traget,optimizers}? 
2) Does the same set of flags apply when makepkg calls /usr/bin/make?

On x86_64

options enabled:  -falign-labels -fasynchronous-unwind-tables
 -fauto-inc-dec -fbranch-count-reg -fcaller-saves
 -fcombine-stack-adjustments -fcommon -fcompare-elim -fcprop-registers
 -fcrossjumping -fcse-follow-jumps -fdefer-pop -fdelete-null-pointer-checks
 -fdevirtualize -fdwarf2-cfi-asm -fearly-inlining
 -feliminate-unused-debug-types -fexpensive-optimizations
 -fforward-propagate -ffunction-cse -fgcse -fgcse-lm
 -fguess-branch-probability -fident -fif-conversion -fif-conversion2
 -findirect-inlining -finline -finline-functions-called-once
 -finline-small-functions -fipa-cp -fipa-profile -fipa-pure-const
 -fipa-reference -fipa-sra -fira-share-save-slots -fira-share-spill-slots
 -fivopts -fkeep-static-consts -fleading-underscore -fmath-errno
 -fmerge-constants -fmerge-debug-strings -fmove-loop-invariants
 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls
 -fpartial-inlining -fpeephole -fpeephole2 -fprefetch-loop-arrays
 -freg-struct-return -fregmove -freorder-blocks -freorder-functions
 -frerun-cse-after-loop -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-insns2
 -fshow-column -fsigned-zeros -fsplit-ivs-in-unroller -fsplit-wide-types
 -fstrict-aliasing -fstrict-overflow -fstrict-volatile-bitfields
 -fthread-jumps -ftoplevel-reorder -ftrapping-math -ftree-bit-ccp
 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop
 -ftree-copyrename -ftree-cselim -ftree-dce -ftree-dominator-opts
 -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-if-convert
 -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize
 -ftree-parallelize-loops= -ftree-phiprop -ftree-pre -ftree-pta
 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slp-vectorize
 -ftree-sra -ftree-switch-conversion -ftree-ter -ftree-vect-loop-version
 -ftree-vrp -funit-at-a-time -funwind-tables -fvar-tracking
 -fvar-tracking-assignments -fvect-cost-model -fzee
 -fzero-initialized-in-bss -m128bit-long-double -m64 -m80387
 -maccumulate-outgoing-args -malign-stringops -mcx16 -mfancy-math-387
 -mfp-ret-in-387 -mglibc -mieee-fp -mmmx -mpush-args -mred-zone -msahf
 -msse -msse2 -msse3 -msse4.1 -mssse3 -mtls-direct-seg-refs

On i686:

options enabled:  -falign-labels -fasynchronous-unwind-tables
 -fauto-inc-dec -fbranch-count-reg -fcaller-saves
 -fcombine-stack-adjustments -fcommon -fcompare-elim -fcprop-registers
 -fcrossjumping -fcse-follow-jumps -fdefer-pop -fdelete-null-pointer-checks
 -fdevirtualize -fdwarf2-cfi-asm -fearly-inlining
 -feliminate-unused-debug-types -fexpensive-optimizations
 -fforward-propagate -ffunction-cse -fgcse -fgcse-lm
 -fguess-branch-probability -fident -fif-conversion -fif-conversion2
 -findirect-inlining -finline -finline-functions-called-once
 -finline-small-functions -fipa-cp -fipa-profile -fipa-pure-const
 -fipa-reference -fipa-sra -fira-share-save-slots -fira-share-spill-slots
 -fivopts -fkeep-static-consts -fleading-underscore -fmath-errno
 -fmerge-constants -fmerge-debug-strings -fmove-loop-invariants
 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls
 -fpartial-inlining -fpcc-struct-return -fpeephole -fpeephole2
 -fprefetch-loop-arrays -fregmove -freorder-blocks -freorder-functions
 -frerun-cse-after-loop -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-insns2
 -fshow-column -fsigned-zeros -fsplit-ivs-in-unroller -fsplit-wide-types
 -fstrict-aliasing -fstrict-overflow -fstrict-volatile-bitfields
 -fthread-jumps -ftoplevel-reorder -ftrapping-math -ftree-bit-ccp
 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop
 -ftree-copyrename -ftree-cselim -ftree-dce -ftree-dominator-opts
 -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-if-convert
 -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize
 -ftree-parallelize-loops= -ftree-phiprop -ftree-pre -ftree-pta
 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slp-vectorize
 -ftree-sra -ftree-switch-conversion -ftree-ter -ftree-vect-loop-version
 -ftree-vrp -funit-at-a-time -funwind-tables -fvar-tracking
 -fvar-tracking-assignments -fvect-cost-model -fzero-initialized-in-bss
 -m32 -m80387 -m96bit-long-double -maccumulate-outgoing-args
 -malign-stringops -mcx16 -mfancy-math-387 -mfp-ret-in-387 -mglibc
 -mieee-fp -mmmx -mno-red-zone -mpush-args -msahf -msse -msse2 -msse3
 -msse4.1 -mssse3 -mtls-direct-seg-refs

Last edited by graysky (2011-04-30 10:34:44)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2011-04-30 12:07:55

sumski
Member
From: Zagreb, Croatia
Registered: 2011-04-30
Posts: 114

Re: gcc 4.6.0 seems to have -fomit-frame-pointer disabled in -O2 ?

gcc version 4.5.2 (Debian 4.5.2-8)

i386 - no fomit-frame-pointer


options passed:  -v test.c -march=core2 -mcx16 -msahf --param
 l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=2048
 -mtune=core2 -O2
options enabled:  -falign-labels -falign-loops -fargument-alias
 -fauto-inc-dec -fbranch-count-reg -fcaller-saves -fcommon
 -fcprop-registers -fcrossjumping -fcse-follow-jumps -fdefer-pop
 -fdelete-null-pointer-checks -fdwarf2-cfi-asm -fearly-inlining
 -feliminate-unused-debug-types -fexpensive-optimizations
 -fforward-propagate -ffunction-cse -fgcse -fgcse-lm
 -fguess-branch-probability -fident -fif-conversion -fif-conversion2
 -findirect-inlining -finline -finline-functions-called-once
 -finline-small-functions -fipa-cp -fipa-pure-const -fipa-reference
 -fipa-sra -fira-share-save-slots -fira-share-spill-slots -fivopts
 -fkeep-static-consts -fleading-underscore -fmath-errno -fmerge-constants
 -fmerge-debug-strings -fmove-loop-invariants -foptimize-register-move
 -foptimize-sibling-calls -fpcc-struct-return -fpeephole -fpeephole2
 -fregmove -freorder-blocks -freorder-functions -frerun-cse-after-loop
 -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-insns2 -fshow-column -fsigned-zeros
 -fsplit-ivs-in-unroller -fsplit-wide-types -fstrict-aliasing
 -fstrict-overflow -fthread-jumps -ftoplevel-reorder -ftrapping-math
 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop
 -ftree-copyrename -ftree-cselim -ftree-dce -ftree-dominator-opts
 -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-im -ftree-loop-ivcanon
 -ftree-loop-optimize -ftree-parallelize-loops= -ftree-phiprop -ftree-pre
 -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
 -ftree-slp-vectorize -ftree-sra -ftree-switch-conversion -ftree-ter
 -ftree-vect-loop-version -ftree-vrp -funit-at-a-time -fvar-tracking
 -fvar-tracking-assignments -fvect-cost-model -fzero-initialized-in-bss
 -m32 -m80387 -m96bit-long-double -maccumulate-outgoing-args
 -malign-stringops -mcx16 -mfancy-math-387 -mfp-ret-in-387 -mfused-madd
 -mglibc -mieee-fp -mmmx -mno-red-zone -mno-sse4 -mpush-args -msahf -msse
 -msse2 -msse3 -mssse3 -mtls-direct-seg-refs

Offline

#7 2011-04-30 14:54:32

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: gcc 4.6.0 seems to have -fomit-frame-pointer disabled in -O2 ?

i386???


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#8 2011-04-30 15:20:27

sumski
Member
From: Zagreb, Croatia
Registered: 2011-04-30
Posts: 114

Re: gcc 4.6.0 seems to have -fomit-frame-pointer disabled in -O2 ?

graysky wrote:

i386???

http://www.debian.org/releases/stable/i … n#id583249

http://www.debian.org/ports/#released

Last edited by sumski (2011-04-30 15:24:56)

Offline

#9 2011-04-30 15:22:47

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: gcc 4.6.0 seems to have -fomit-frame-pointer disabled in -O2 ?

Missed the Debian smile


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#10 2011-04-30 15:26:48

sumski
Member
From: Zagreb, Croatia
Registered: 2011-04-30
Posts: 114

Re: gcc 4.6.0 seems to have -fomit-frame-pointer disabled in -O2 ?

Check this out:
http://www.debian.org/ports/amd64/

gcc omits frame-pointers by default at -O2

Offline

Board footer

Powered by FluxBB