SlideShare ist ein Scribd-Unternehmen logo
1 von 37
Downloaden Sie, um offline zu lesen
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
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, …
OUTLINE
overview
architecture, inputs, targets
standard, compilers and reality
undefined behavior
optimizations
outsmarting compiler
ecosystem
tooling, 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
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
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!!

Weitere ähnliche Inhalte

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

pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptxpdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
GustavoJesus32
 
Marko Gargenta_Remixing android
Marko Gargenta_Remixing androidMarko Gargenta_Remixing android
Marko Gargenta_Remixing android
Droidcon Berlin
 
E xact micro 10 photometer v4
E xact micro 10 photometer v4E xact micro 10 photometer v4
E xact micro 10 photometer v4
Ronnie Lewis
 
Transportation Sector| Analysis and Commentary| November 2021
Transportation Sector| Analysis and Commentary| November 2021Transportation Sector| Analysis and Commentary| November 2021
Transportation Sector| Analysis and Commentary| November 2021
paul young cpa, cga
 

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

Srd991 iom german
Srd991 iom germanSrd991 iom german
Srd991 iom german
 
Srd991 iom german
Srd991 iom germanSrd991 iom german
Srd991 iom german
 
Introduction to Compiler Development
Introduction to Compiler DevelopmentIntroduction to Compiler Development
Introduction to Compiler Development
 
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!
 
rpm-building-101.pdf
rpm-building-101.pdfrpm-building-101.pdf
rpm-building-101.pdf
 
Code GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersCode GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limiters
 
Debian meetup nantes 2015 : Salt pour gérer de nombreux serveurs debian
Debian meetup nantes 2015 : Salt pour gérer de nombreux serveurs debianDebian meetup nantes 2015 : Salt pour gérer de nombreux serveurs debian
Debian meetup nantes 2015 : Salt pour gérer de nombreux serveurs debian
 
Assembly Language Tutorials for Windows - 02 x86-64 Architecture
Assembly Language Tutorials for Windows - 02 x86-64 ArchitectureAssembly Language Tutorials for Windows - 02 x86-64 Architecture
Assembly Language Tutorials for Windows - 02 x86-64 Architecture
 
PyData Barcelona - weather and climate data
PyData Barcelona - weather and climate dataPyData Barcelona - weather and climate data
PyData Barcelona - weather and climate data
 
pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptxpdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
 
Marko Gargenta_Remixing android
Marko Gargenta_Remixing androidMarko Gargenta_Remixing android
Marko Gargenta_Remixing android
 
Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016 Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016
 
Meteor WWNRW Intro
Meteor WWNRW IntroMeteor WWNRW Intro
Meteor WWNRW Intro
 
Transportation Sector| Analysis and Commentary| February 2022
Transportation Sector| Analysis and Commentary| February 2022Transportation Sector| Analysis and Commentary| February 2022
Transportation Sector| Analysis and Commentary| February 2022
 
E xact micro 10 photometer v4
E xact micro 10 photometer v4E xact micro 10 photometer v4
E xact micro 10 photometer v4
 
Amazon VPC and Amazon EC2
Amazon VPC and Amazon EC2Amazon VPC and Amazon EC2
Amazon VPC and Amazon EC2
 
Pipeline your Pipelines - 2020 All Day DevOps
Pipeline your Pipelines - 2020 All Day DevOpsPipeline your Pipelines - 2020 All Day DevOps
Pipeline your Pipelines - 2020 All Day DevOps
 
Transportation Sector| Analysis and Commentary| November 2021
Transportation Sector| Analysis and Commentary| November 2021Transportation Sector| Analysis and Commentary| November 2021
Transportation Sector| Analysis and Commentary| November 2021
 
Model Serving via Pulsar Functions
Model Serving via Pulsar FunctionsModel Serving via Pulsar Functions
Model Serving via Pulsar Functions
 

Mehr von Sławomir Zborowski

Mehr von Sławomir Zborowski (8)

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

Kürzlich hochgeladen

DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 

Kürzlich hochgeladen (20)

HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
457503602-5-Gas-Well-Testing-and-Analysis-pptx.pptx
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
💚Trustworthy Call Girls Pune Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top...
 

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