This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Disable BOLT instrumentation of Clang on instrumented build
ClosedPublic

Authored by Amir on Oct 15 2022, 11:05 AM.

Details

Summary

This enables multi-stage PGO build optimized by BOLT using BOLT.cmake cache.

The issue is that -DPGO_BUILD_CONFIGURATION cache file is passed to both
stage2-instrumented and stage2-optimized builds (for them to be identical),
but in case of BOLT.cmake, it doesn't make sense to BOLT-instrument the
instrumented binary (it's not going to be optimized). Hence turn off
CLANG_BOLT_INSTRUMENT code if LLVM_BUILD_INSTRUMENTED is enabled.

The final workflow that enables multi-stage InstrPGO+ThinLTO+BOLT Clang build:

cmake <llvm-project>/llvm -GNinja -DLLVM_ENABLE_LLD=ON \
  -DBOOTSTRAP_LLVM_ENABLE_LLD=ON -DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \
  -DPGO_INSTRUMENT_LTO=Thin -C llvm-project/clang/cmake/caches/BOLT-PGO.cmake
ninja stage2-clang++-bolt

Diff Detail

Event Timeline

Amir created this revision.Oct 15 2022, 11:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 15 2022, 11:05 AM
Herald added a subscriber: wenlei. · View Herald Transcript
Amir requested review of this revision.Oct 15 2022, 11:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 15 2022, 11:05 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Amir updated this revision to Diff 468030.Oct 15 2022, 12:59 PM

Add BOLT-PGO cmake cache file

Amir edited the summary of this revision. (Show Details)Oct 15 2022, 12:59 PM
rafauler accepted this revision.Oct 19 2022, 6:16 PM
This revision is now accepted and ready to land.Oct 19 2022, 6:16 PM