clang-misexpect - Managing your __builtin_expect(ations)
summary
Adds clang/LLVM diagnostics that compare __builtin_expect annotations against PGO-collected basic-block counters and warn when the annotation contradicts observed runtime frequencies. Uses the PGO pipeline and emits -Wmiss-expect warnings or -Rpass=miss-expect optimization remarks; a standalone clang-tidy–style tool consumes compile_commands.json plus the PGO profile and scans a whole repo. Available in tip-of-tree/patch review, it finds mispredictions reliably but requires a representative profile or diagnostics will be misleading.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 0:27Builtinexpect
- 0:54Annotation
- 1:17Performance
- 2:02PG
- 2:36Diagnostics
- 3:07Limitations
- 3:33Usage
related talks
14mSynchronized Behavior Checking: A Method for Finding Missed Compiler Optimizations
29mEmpirical Observations about Profile-Guided Optimizations for Mainstream C/C++ Compilers
24mGenerating BPF Verifier Friendly Code with Clang
01h 24mExtending clang-tidy in the Present and in the Future
22mBeacons: An End-to-End Compiler Framework for Predicting and Utilizing Dynamic ...
01h 03mCLANG + C2 - Engineering/Futures/Measurements
24mCompiling for verified targets BPF
18mRobustifying Debug Information Updates in LLVM via Control-Flow Conformance Analysis
