~/talk

C++ devirtualization in clang

Talkat CppCon 2015 · 2015-09-21..09-25· [compilers-and-language-design, c-and-cpp]

Clang implements devirtualization by adding LLVM-level checks and metadata: it inserts llvm.assume checks after constructors, uses available_externally vtable linkage when safe, and introduces invariant-group metadata plus barrier calls to let the optimizer treat repeated vptr loads as identical. Placement new, inline virtuals and key-function vtable placement force conservative behavior, so an LTO-aware compiler flag and runtime-UB diagnostics are required. Implementation is experimental, LTO compatibility is tricky, and performance numbers are not yet finalized.

AI-written summary · about

  1. 0:00Intro
  2. 0:58How virtual calls works
  3. 1:53Old devirtualization
  4. 4:42Calling the same virtual function
  5. 5:09Placement new is evil
  6. 6:38assuming type after ctor call
  7. 7:50available_externally vtables
  8. 8:49propagating "constness" of vptr
  9. 9:29introducing linvariant.group
  10. 10:04Dealing with placement new
  11. 10:42introducing invariant.group.barrier
  12. 11:09introducing -fstrict-vtable-pointers
  13. 12:49Corner cases
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.