forked from dotnet/coreclr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PGO support for Clang/LLVM on Unix (dotnet#10533)
Extend PGO support from VC++ on WIN32 to Clang/LLVM on UNIX as well. * Just like on Windows: if profile data is missing, skip enabling PGO (allows non-PGO builds in branches where we don't publish PGO data). * PGO with LTO requires additional dependencies (namely a discoverable `ld.gold` and `LLVMgold.so`). To protect against broken support and keep the build flexible across a wider array of distros, attempt to detect whether PGO compilation would work (using cmake's `try_compile()`), and fall back to a non-PGO/non-LTO build if the test fails.
- Loading branch information
Daniel Podder
authored
Mar 30, 2017
1 parent
f990ce6
commit 926d104
Showing
3 changed files
with
42 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
include(CheckCXXSourceCompiles) | ||
|
||
# VC++ guarantees support for LTCG (LTO's equivalent) | ||
if(NOT WIN32) | ||
# Function required to give CMAKE_REQUIRED_* local scope | ||
function(check_have_lto) | ||
set(CMAKE_REQUIRED_FLAGS -flto) | ||
set(CMAKE_REQUIRED_LIBRARIES -flto -fuse-ld=gold) | ||
check_cxx_source_compiles("int main() { return 0; }" HAVE_LTO) | ||
endfunction(check_have_lto) | ||
check_have_lto() | ||
endif(NOT WIN32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters