what every c++ programmer should know about modern compilers (w/o comments, accu 2016)
TRANSCRIPT
WHAT EVERY C++ PROGRAMMER SHOULDKNOW ABOUT MODERN COMPILERS
SŁAWOMIR ZBOROWSKIACCU 2016, BRISTOL, UK
SŁAWEK ZBOROWSKIWROCŁAW, POLAND
OUTLINEoverviewarchitecture, inputs, targets
standard, compilers and realityundefined behavior
optimizationsoutsmarting compiler
ecosystemtooling, further optimizations
OUTLINEoverviewarchitecture, inputs, targets
standard, compilers and realityundefined behavior
optimizationsoutsmarting compiler
ecosystemtooling, further optimizations
h t t p : / / l e a n i n g t e c h . c o m / c h e e r p /
ARCHITECTURE OVERVIEW
h t t p s : / / d e v h u m o r . c o m / c o n t e n t / u p l o a d s / / i m a g e s / O c t o b e r 2 0 1 5 / F r o n t - e n d - x - B a c k - e n d . j p g
FLAGS Newbie -o
Junior -c, -Wl,-shared, -Wl,-static, …
Average -Wall, -Wextra, -Werror, -O2, …
Expert -finline-limit, -ftemplate-depth, …
Ninja -B, -nostdlib, …
OUTLINEoverviewarchitecture, inputs, targets
standard, compilers and realityundefined behavior
optimizationsoutsmarting compiler
ecosystemtooling, further optimizations
h t t p : / / c o m m u n i t y . f a n s s h a r e . c o m / p i c 1 0 8 / w / t r a d u c i a n i s m / 1 2 0 0 / 1 7 5 2 _ c a u t i o n _ t h i s _ i s _ s p a r t a _ j e x . j p g
h t t p : / / f a c s t a f f . c b u . e d u / s e i s e n / C a d F a 0 9 1 3 _ f i l e s / i m a g e 0 3 2 . j p g
UNDEFINEDBEHAVIORSANITIZER
h t t p s : / / w w w . y o u t u b e . c o m / w a t c h ? v = H f - z n K i V w y k
OUTLINEoverviewarchitecture, inputs, targets
standard, compilers and realityundefined behavior
optimizationsoutsmarting compiler
ecosystemtooling, further optimizations
OPTIMIZATIONS
OUTSMARTING COMPILER1 auto tmp = a;2 a = b;3 b = tmp;
1 a ̂= b;2 b ̂= a;3 a ̂= b;
h t t p s : / / w w w . y o u t u b e . c o m / w a t c h ? v = b S 5 P _ L A q i V g
COMPILER'S KNOWLEDGECPU CACHES
CPU EXTENSIONSCPU PERFORMANCE BUGS
INSTRUCTION SIZES (IN BINARY)…
OUTLINEoverviewarchitecture, inputs, targets
standard, compilers and realityundefined behavior
optimizationsoutsmarting compiler
ecosystemtooling, further optimizations
INSTRUMENTALIZATIONADDRESS SANITIZERMEMORY SANITIZERCONTROL FLOW SANITIZERTHREAD SANITIZEREFFICIENCY SANITIZER…
h t t p s : / / b o u r n e t o c o d e . c o m / p r o j e c t s / G C S E _ C o m p u t i n g _ F u n d a m e n t a l s / p a g e s / i m g / R A M . j p g
h t t p : / / c r e a t e . p r o / b l o g / w p - c o n t e n t / u p l o a d s / 2 0 1 4 / 1 2 / M a c - P r o - M u l t i - C o r e - P r o c e s s o r - 3 -e 1 4 1 8 6 5 8 6 8 9 8 7 8 . j p g
CLANG TOOLSCLANG-FORMATCLANG-TIDYCLANG-COMPLETECLANG-ANALYZER…
h t t p s : / / u p l o a d . w i k i m e d i a . o r g / w i k i p e d i a / e n / 4 / 4 c / L L V M _ L o g o . s v g
TEMPLIGHT / TEMPLATOR
h t t p s : / / g i t h u b . c o m / m i k a e l - s - p e r s s o n / t e m p l i g h t - t o o l s
SYNTH
STOKEStochastic optimizer (x86_64)
THANKS!!