Hi All,
Some of you probably saw performance benchmarking of OpenMP-enabled clang compiler published on Phoronix web-site: http://www.phoronix.com/scan.php?page=article&item=llvm_clang_openmp&num=1
As you can see, clang-omp is behind gcc in most of the benchmarks. The reason is quite simple: no -O options supplied to both compilers, so gcc assumed -O2 by default, while clang assumed -O0. No surprise gcc got ahead!
We added -O2 to clang and re-measured, and results changed quite significantly. My Intel colleague, Alexey Bataev, informed Michael Larabel on this omission.
Yours,
Andrey
Andrey,
FSF gcc is not exactly defaulting to -O2 but certainly is higher than the default optimizations on clang….
% touch t.cc
% g+±fsf-4.9 -fverbose-asm t.cc -S
% more t.s
GNU C++ (GCC) version 4.9.0 (x86_64-apple-darwin11.4.2)
compiled by GNU C version 4.9.0, GMP version 6.0.0, MPFR version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
options passed: -D__DYNAMIC__ t.cc -fPIC -mmacosx-version-min=10.7.4
-mtune=core2 -fverbose-asm
options enabled: -Wnonportable-cfstrings -fPIC
-faggressive-loop-optimizations -fasynchronous-unwind-tables
-fauto-inc-dec -fcommon -fdelete-null-pointer-checks -fearly-inlining
-feliminate-unused-debug-types -fexceptions -ffunction-cse -fgcse-lm
-fgnu-unique -fident -finline-atomics -fira-hoist-pressure
-fira-share-save-slots -fira-share-spill-slots -fivopts
-fkeep-static-consts -fleading-underscore -fmath-errno
-fmerge-debug-strings -fnext-runtime -fobjc-abi-version= -fpeephole
-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 -fshow-column -fsigned-zeros
-fsplit-ivs-in-unroller -fstrict-volatile-bitfields -fsync-libcalls
-ftrapping-math -ftree-coalesce-vars -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 -gstrict-dwarf
-m128bit-long-double -m64 -m80387 -malign-stringops -matt-stubs
-mconstant-cfstrings -mfancy-math-387 -mfp-ret-in-387 -mfxsr -mieee-fp
-mlong-double-80 -mmmx -mno-sse4 -mpush-args -mred-zone -msse -msse2
-msse3
.constructor
.destructor
.align 1
.subsections_via_symbols
% g+±fsf-4.9 -fverbose-asm -O2 t.cc -S
% more t.s
GNU C++ (GCC) version 4.9.0 (x86_64-apple-darwin11.4.2)
compiled by GNU C version 4.9.0, GMP version 6.0.0, MPFR version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
options passed: -D__DYNAMIC__ t.cc -fPIC -mmacosx-version-min=10.7.4
-mtune=core2 -O2 -fverbose-asm
options enabled: -Wnonportable-cfstrings -fPIC
-faggressive-loop-optimizations -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 -fdevirtualize-speculatively
-fearly-inlining -feliminate-unused-debug-types -fexceptions
-fexpensive-optimizations -fforward-propagate -ffunction-cse -fgcse
-fgcse-lm -fgnu-unique -fguess-branch-probability -fhoist-adjacent-loads
-fident -fif-conversion -fif-conversion2 -findirect-inlining -finline
-finline-atomics -finline-functions-called-once -finline-small-functions
-fipa-cp -fipa-profile -fipa-pure-const -fipa-reference -fipa-sra
-fira-hoist-pressure -fira-share-save-slots -fira-share-spill-slots
-fisolate-erroneous-paths-dereference -fivopts -fkeep-static-consts
-fleading-underscore -fmath-errno -fmerge-constants -fmerge-debug-strings
-fmove-loop-invariants -fnext-runtime -fobjc-abi-version=
-fomit-frame-pointer -foptimize-sibling-calls -foptimize-strlen
-fpartial-inlining -fpeephole -fpeephole2 -fprefetch-loop-arrays -free
-freg-struct-return -freorder-blocks -freorder-blocks-and-partition
-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 -fshrink-wrap
-fsigned-zeros -fsplit-ivs-in-unroller -fsplit-wide-types
-fstrict-aliasing -fstrict-overflow -fstrict-volatile-bitfields
-fsync-libcalls -fthread-jumps -ftoplevel-reorder -ftrapping-math
-ftree-bit-ccp -ftree-builtin-call-dce -ftree-ccp -ftree-ch
-ftree-coalesce-vars -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-slsr
-ftree-sra -ftree-switch-conversion -ftree-tail-merge -ftree-ter
-ftree-vrp -funit-at-a-time -funwind-tables -fverbose-asm
-fzero-initialized-in-bss -gstrict-dwarf -m128bit-long-double -m64
-m80387 -malign-stringops -matt-stubs -mconstant-cfstrings
-mfancy-math-387 -mfp-ret-in-387 -mfxsr -mieee-fp -mlong-double-80 -mmmx
-mno-sse4 -mpush-args -mred-zone -msse -msse2 -msse3 -mvzeroupper
.constructor
.destructor
.align 1
.subsections_via_symbols
You might consider filing an enhancement request for clang 3.5 to have the default behavior without optimization flags bumped up to -O1.
Jack