LLVM Optimization Remarks - Ofek Shilon - CppCon 2022

preview_player
Показать описание
---

LLVM Optimization Remarks - Helping the Compiler Generate Better Code - Ofek Shilon - CppCon 2022

Optimization remarks are Clang's logs of optimization passes, which include leads into optimization failures that might be mitigated. Deciphering raw optimization remarks seems a matter for compiler authors and select few experts, but a little-known tool called opt-viewer aims to change that - in particular with recent improvements by myself and others.

About 50% of the talk would be dedicated to real examples of missed optimizations. Most turn out to be escape-analysis and alias-analysis related, and we will devote time to discuss these in some depth.

We will also extend the discussion to other compilers and even other languages. (you really can't have a C++ presentation in Sep 2022 without at least mentioning Rust and Carbon).

If you care about performance there's an excellent chance you'd leave this talk with immediately actionable insights and surprising ways to check and improve your code in performance bottlenecks.
---

Ofek Shilon

20Y C++ developer, writer and speaker in both the Linux and MS universes. Fascinated by compilers, debuggers and pretty much anything low level. Fiercely hated by his cat for no apparent reason.
---

#cppcon #programming #llvm
Рекомендации по теме
Комментарии
Автор

This man talks like a very good university professor

casperes
Автор

Very useful talk, thank you! If programmers were taught this stuff we would live in a better world...

glorioussir
Автор

Excellent lecture! I enjoyed it and learned a lot. Thank you!

Regarding the third example, declaring somefunc to be constexpr (passing the argument by const reference doesn't preclude the possibility of doing so) would be a standard way to declare it pure.

momoanddudu
Автор

This is awesome, I can't wait to make use of it at work.

piotrarturklos
Автор

great talk!

I was surprised by how much of it I could follow 😁

benjaminshinar
Автор

Awesome feature! Great talk, thank you!

BalanNarcis
Автор

It would be nice to have the links from the presentation also in the description.

simonhrabec
Автор

This was a very nice talk, but why the incredible handsome man near the airplane in the first slide?

pietro
Автор

20:25 I saw earlier that const variables are protected by mprotect function and modifying the const variable causes seg fault in program! I confused..

mohammadmahdifarnia
Автор

52:50 Fedor Pikus is such a C++ mastermind... omg

ProfessorWaltherKotz
Автор

The absolute most important thing to help the optimizer produce code that works is to write C or C++ code. In both languages it is possible to easily write code that is nearly correct but has undefined behavior in the standard. The optimizer may well produce totally bad object code in such cases. The compiler is often not required to diagnose such situations.

williamdavidwallace
Автор

17:37, there's a better solution to __restrict__, remove that unnecessary & symbol from b

zxuiji
Автор

33:46 wait whaaatt? omg how is that possible

dexterman
Автор

Here's one thing I don't get, why is on the compiler to do the optimisations? why can't we just produce debug objects only and then tell the linker what type of binary we want to produce, a debug binary, a striped down release binary, a profiled binary, all of those should be the linker's job to produce from the objects we generate, not the compiler's job, since the linker would have access to all the information it would need to identify if some functions could be made smaller as it could go off to the definition of a function and see what it modifies.

zxuiji
Автор

Nice presentation, but please stop the AT&T assembly notation nonsense. Use the Intel notation. CPU manuals use Intel notation. AT&T notation was designed for compatibility with PDP machines which don't exist anymore. There's no reason for AT&T notation to exist in 2024.

antekone