SlideShare a Scribd company logo
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
outsmarting compiler
ecosystem
tooling, further optimizations
OUTLINE
overview
architecture, inputs, targets
standard, compilers and reality
undefined behavior
optimizations
outsmarting compiler
ecosystem
tooling, further optimizations
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)
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, …
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
OUTLINE
overview
architecture, inputs, targets
standard, compilers and reality
undefined behavior
optimizations
outsmarting compiler
ecosystem
tooling, further optimizations
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
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
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)
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
outsmarting compiler
ecosystem
tooling, further optimizations
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 e . c o m / w a t c h ? v = b S 5 P _ L A q i V g
What every C++ programmer should know about modern compilers (w/o comments, ACCU 2016)
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
outsmarting compiler
ecosystem
tooling, further optimizations
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
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
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!!

More Related Content

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

PDF
Srd991 iom german
IkhuoshoAbode
 
PDF
Srd991 iom german
IkhuoshoAbode
 
PDF
Introduction to Compiler Development
Logan Chien
 
PDF
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
Pôle Systematic Paris-Region
 
PDF
PyLadies Talk: Learn to love the command line!
Blanca Mancilla
 
PDF
rpm-building-101.pdf
stroganovboris
 
PDF
Code GPU with CUDA - Identifying performance limiters
Marina Kolpakova
 
PDF
Debian meetup nantes 2015 : Salt pour gérer de nombreux serveurs debian
Arthur Lutz
 
PPTX
Assembly Language Tutorials for Windows - 02 x86-64 Architecture
Sangram Kesari Ray
 
PDF
RFID Parking System Presentationnnnnnnn.pdf
JoemilMujar1
 
PDF
PyData Barcelona - weather and climate data
Margriet Groenendijk
 
PDF
Customer_Testimonial_IFFCO.pdf
PRASHANTJUNNARKAR
 
PPTX
pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
GustavoJesus32
 
PDF
Marko Gargenta_Remixing android
Droidcon Berlin
 
PDF
Spring Roo 2.0 Preview at Spring I/O 2016
DISID
 
PDF
Meteor WWNRW Intro
Stephan Hochhaus
 
PPTX
Transportation Sector| Analysis and Commentary| February 2022
paul young cpa, cga
 
PPS
E xact micro 10 photometer v4
Ronnie Lewis
 
PDF
Amazon VPC and Amazon EC2
Daiki Mori
 
PPTX
Pipeline your Pipelines - 2020 All Day DevOps
Giulio Vian
 
Srd991 iom german
IkhuoshoAbode
 
Srd991 iom german
IkhuoshoAbode
 
Introduction to Compiler Development
Logan Chien
 
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
Pôle Systematic Paris-Region
 
PyLadies Talk: Learn to love the command line!
Blanca Mancilla
 
rpm-building-101.pdf
stroganovboris
 
Code GPU with CUDA - Identifying performance limiters
Marina Kolpakova
 
Debian meetup nantes 2015 : Salt pour gérer de nombreux serveurs debian
Arthur Lutz
 
Assembly Language Tutorials for Windows - 02 x86-64 Architecture
Sangram Kesari Ray
 
RFID Parking System Presentationnnnnnnn.pdf
JoemilMujar1
 
PyData Barcelona - weather and climate data
Margriet Groenendijk
 
Customer_Testimonial_IFFCO.pdf
PRASHANTJUNNARKAR
 
pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
GustavoJesus32
 
Marko Gargenta_Remixing android
Droidcon Berlin
 
Spring Roo 2.0 Preview at Spring I/O 2016
DISID
 
Meteor WWNRW Intro
Stephan Hochhaus
 
Transportation Sector| Analysis and Commentary| February 2022
paul young cpa, cga
 
E xact micro 10 photometer v4
Ronnie Lewis
 
Amazon VPC and Amazon EC2
Daiki Mori
 
Pipeline your Pipelines - 2020 All Day DevOps
Giulio Vian
 

More from Sławomir Zborowski (8)

PDF
C++ Undefined Behavior (Code::Dive 2016)
Sławomir Zborowski
 
PDF
Algorithms for Cloud Computing
Sławomir Zborowski
 
PDF
C++17 - the upcoming revolution (Code::Dive 2015)/
Sławomir Zborowski
 
PDF
More functional C++14
Sławomir Zborowski
 
PDF
Boost.Python - domesticating the snake
Sławomir Zborowski
 
PDF
Metaprogramming in C++ - from 70's to C++17
Sławomir Zborowski
 
PDF
Boost Multi Index
Sławomir Zborowski
 
PDF
How it's made: C++ compilers (GCC)
Sławomir Zborowski
 
C++ Undefined Behavior (Code::Dive 2016)
Sławomir Zborowski
 
Algorithms for Cloud Computing
Sławomir Zborowski
 
C++17 - the upcoming revolution (Code::Dive 2015)/
Sławomir Zborowski
 
More functional C++14
Sławomir Zborowski
 
Boost.Python - domesticating the snake
Sławomir Zborowski
 
Metaprogramming in C++ - from 70's to C++17
Sławomir Zborowski
 
Boost Multi Index
Sławomir Zborowski
 
How it's made: C++ compilers (GCC)
Sławomir Zborowski
 
Ad

Recently uploaded (20)

PPTX
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PDF
MOBILE AND WEB BASED REMOTE BUSINESS MONITORING SYSTEM
ijait
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PDF
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
PDF
A presentation on the Urban Heat Island Effect
studyfor7hrs
 
PPTX
Thermal runway and thermal stability.pptx
godow93766
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PDF
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
PPTX
Green Building & Energy Conservation ppt
Sagar Sarangi
 
PPTX
NEUROMOROPHIC nu iajwojeieheueueueu.pptx
knkoodalingam39
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
PDF
monopile foundation seminar topic for civil engineering students
Ahina5
 
PPTX
Structural Functiona theory this important for the theorist
cagumaydanny26
 
PPTX
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
PPTX
drones for disaster prevention response.pptx
NawrasShatnawi1
 
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
MOBILE AND WEB BASED REMOTE BUSINESS MONITORING SYSTEM
ijait
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
A presentation on the Urban Heat Island Effect
studyfor7hrs
 
Thermal runway and thermal stability.pptx
godow93766
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
Hashing Introduction , hash functions and techniques
sailajam21
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
Green Building & Energy Conservation ppt
Sagar Sarangi
 
NEUROMOROPHIC nu iajwojeieheueueueu.pptx
knkoodalingam39
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
monopile foundation seminar topic for civil engineering students
Ahina5
 
Structural Functiona theory this important for the theorist
cagumaydanny26
 
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
drones for disaster prevention response.pptx
NawrasShatnawi1
 
Ad

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