Master the fundamental concepts of compiler optimization techniques through this focused micro-challenge.
Link-Time Optimization (LTO) stores LLVM bitcode or GCC GIMPLE in .o files and runs optimization when linking. Cross-module inlining and devirtualization become possible. Chrome and Rust release builds rely on thin LTO for large link times.
Clang: -flto=thin at compile and link. GCC: -flto plus use gcc driver for the final link. Static libraries must be built with LTO objects too.
bashLoading…
-g at LTO link for usable stacksnm symbol counts before/after cross-module inlineKeep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will build a two-file project with and without LTO and measure call overhead across translation units. This exercise asks you to show one function inlined only in the LTO build.
Demonstrate Link-Time Optimization (LTO) with performance measurement.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github