SlideShare uma empresa Scribd logo
1 de 37
Baixar para ler offline
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!!

Mais conteúdo relacionado

Semelhante a 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
 

Semelhante a 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
 

Mais de Sławomir Zborowski

Mais de 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)
 

Último

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
pritamlangde
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 

Último (20)

Learn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic MarksLearn the concepts of Thermodynamics on Magic Marks
Learn the concepts of Thermodynamics on Magic Marks
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.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
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
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
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Digital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptxDigital Communication Essentials: DPCM, DM, and ADM .pptx
Digital Communication Essentials: DPCM, DM, and ADM .pptx
 
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
 
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
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
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
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
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
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
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
 

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