summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2016-02-04 07:28:30 +0000
committerJustin Bogner <mail@justinbogner.com>2016-02-04 07:28:30 +0000
commite12385bd6a764aed0384ab3b5376030ec4159024 (patch)
tree9c601d4a154efe9fdcf03e01f7f5aa76dd3a0de8 /llvm
parentd7ccafe35f292401f7e3905d67cf5122fa1bb380 (diff)
downloadbcm5719-llvm-e12385bd6a764aed0384ab3b5376030ec4159024.tar.gz
bcm5719-llvm-e12385bd6a764aed0384ab3b5376030ec4159024.zip
cmake: Add a flag to enable LTO
This adds -DLLVM_ENABLE_LTO, rather than forcing people to manually add -flto to the various _FLAGS variables. llvm-svn: 259766
Diffstat (limited to 'llvm')
-rw-r--r--llvm/cmake/modules/HandleLLVMOptions.cmake7
-rw-r--r--llvm/docs/CMake.rst4
2 files changed, 11 insertions, 0 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 9b6a590920e..99b23180bbb 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -656,6 +656,13 @@ append_if(LLVM_BUILD_INSTRUMENTED "-fprofile-instr-generate"
CMAKE_EXE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS)
+option(LLVM_ENABLE_LTO "Enable link-time optimization" OFF)
+append_if(LLVM_ENABLE_LTO "-flto"
+ CMAKE_CXX_FLAGS
+ CMAKE_C_FLAGS
+ CMAKE_EXE_LINKER_FLAGS
+ CMAKE_SHARED_LINKER_FLAGS)
+
# Plugin support
# FIXME: Make this configurable.
if(WIN32 OR CYGWIN)
diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index 4e5feae9993..6d61442ed97 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -347,6 +347,10 @@ LLVM-specific variables
are ``Address``, ``Memory``, ``MemoryWithOrigins``, ``Undefined``, ``Thread``,
and ``Address;Undefined``. Defaults to empty string.
+**LLVM_ENABLE_LTO**:BOOL
+ Add the ``-flto`` flag to the compile and link command lines,
+ enabling link-time optimization. Defaults to OFF.
+
**LLVM_PARALLEL_COMPILE_JOBS**:STRING
Define the maximum number of concurrent compilation jobs.
OpenPOWER on IntegriCloud