Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
WHAT EVERY C++ PROGRAMMER SHOULD
KNOW ABOUT MODERN COMPILERS
SŁAWOMIR ZBOROWSKI
ACCU 2016, BRISTOL, UK
SŁAWEK ZBOROWSKI
WROCŁAW, POLAND
OUTLINE
overview
architecture, inputs, targets
standard, compilers and reality
undefined behavior
optimizations
outsmartin...
OUTLINE
overview
architecture, inputs, targets
standard, compilers and reality
undefined behavior
optimizations
outsmartin...
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 ...
FLAGS
 Newbie -o
 Junior -c, -Wl,-shared, -Wl,-static, …
 Average -Wall, -Wextra, -Werror, -O2, …
 Expert -finline-limit, ...
OUTLINE
overview
architecture, inputs, targets
standard, compilers and reality
undefined behavior
optimizations
outsmartin...
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 ...
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
UNDEFINED
BEHAVIOR
SANITIZER
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
OUTLINE
overview
architecture, inputs, targets
standard, compilers and reality
undefined behavior
optimizations
outsmartin...
OPTIMIZATIONS
OUTSMARTING COMPILER
1 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...
COMPILER'S KNOWLEDGE
CPU CACHES
CPU EXTENSIONS
CPU PERFORMANCE BUGS
INSTRUCTION SIZES (IN BINARY)
…
OUTLINE
overview
architecture, inputs, targets
standard, compilers and reality
undefined behavior
optimizations
outsmartin...
INSTRUMENTALIZATION
ADDRESS SANITIZER
MEMORY SANITIZER
CONTROL FLOW SANITIZER
THREAD SANITIZER
EFFICIENCY SANITIZER
…
h t ...
CLANG TOOLS
CLANG-FORMAT
CLANG-TIDY
CLANG-COMPLETE
CLANG-ANALYZER
…
h t t p s : / / u p l o a d . w i k i m e d i a . o r ...
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
STOKE
Stochastic optimizer (x86_64)
THANKS!!
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
Upcoming SlideShare
Loading in …5
×

What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)

313 views

Published on

YT: https://www.youtube.com/watch?v=nfDTTxH5DsI
Many C++ programmers (especially beginners) either underestimate or don't actually know the power of modern C++ compilers. In the presentation I discuss architecture of modern compilers, how big they are and features (including recently emerged ones) that everyone should be aware of. I also cover tooling and ecosystem that has grown around compilers.

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)

  1. 1. WHAT EVERY C++ PROGRAMMER SHOULD KNOW ABOUT MODERN COMPILERS SŁAWOMIR ZBOROWSKI ACCU 2016, BRISTOL, UK
  2. 2. SŁAWEK ZBOROWSKI WROCŁAW, POLAND
  3. 3. OUTLINE overview architecture, inputs, targets standard, compilers and reality undefined behavior optimizations outsmarting compiler ecosystem tooling, further optimizations
  4. 4. OUTLINE overview architecture, inputs, targets standard, compilers and reality undefined behavior optimizations outsmarting compiler ecosystem tooling, further optimizations
  5. 5. h t t p : / / l e a n i n g t e c h . c o m / c h e e r p /
  6. 6. ARCHITECTURE OVERVIEW
  7. 7. 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
  8. 8. FLAGS  Newbie -o  Junior -c, -Wl,-shared, -Wl,-static, …  Average -Wall, -Wextra, -Werror, -O2, …  Expert -finline-limit, -ftemplate-depth, …  Ninja -B, -nostdlib, …
  9. 9. OUTLINE overview architecture, inputs, targets standard, compilers and reality undefined behavior optimizations outsmarting compiler ecosystem tooling, further optimizations
  10. 10. 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
  11. 11. 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
  12. 12. UNDEFINED BEHAVIOR SANITIZER
  13. 13. 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
  14. 14. OUTLINE overview architecture, inputs, targets standard, compilers and reality undefined behavior optimizations outsmarting compiler ecosystem tooling, further optimizations
  15. 15. OPTIMIZATIONS
  16. 16. OUTSMARTING COMPILER 1 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
  17. 17. COMPILER'S KNOWLEDGE CPU CACHES CPU EXTENSIONS CPU PERFORMANCE BUGS INSTRUCTION SIZES (IN BINARY) …
  18. 18. OUTLINE overview architecture, inputs, targets standard, compilers and reality undefined behavior optimizations outsmarting compiler ecosystem tooling, further optimizations
  19. 19. INSTRUMENTALIZATION ADDRESS SANITIZER MEMORY SANITIZER CONTROL FLOW SANITIZER THREAD SANITIZER EFFICIENCY 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
  20. 20. CLANG TOOLS CLANG-FORMAT CLANG-TIDY CLANG-COMPLETE CLANG-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
  21. 21. 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
  22. 22. SYNTH
  23. 23. STOKE Stochastic optimizer (x86_64)
  24. 24. THANKS!!

×