[llvm-dev] Building with LLVM_PARALLEL_XXX_JOBS
Sedat Dilek via llvm-dev
llvm-dev at lists.llvm.org
Fri Mar 18 01:41:35 PDT 2016
On Fri, Mar 18, 2016 at 9:18 AM, Sedat Dilek <sedat.dilek at gmail.com> wrote:
> On Thu, Mar 17, 2016 at 11:45 AM, Sedat Dilek <sedat.dilek at gmail.com> wrote:
>> On Thu, Mar 17, 2016 at 10:05 AM, Sedat Dilek <sedat.dilek at gmail.com> wrote:
>>> On Mon, Mar 14, 2016 at 5:30 PM, Chris Bieneman <cbieneman at apple.com> wrote:
>>> [ brutal-snip ]
>>> ...
>>>> [ TODO#S: Before doing a 2nd build (and in a 3rd run using more
>>>> optimized binaries) ]
>>>>
>>>> How do I anable LTO via CMAKE?
>>>>
>>>>
>>>> LLVM_ENALBLE_LTO=On
>>>>
>>>
>>> [ v4 of my build-script attached ]
>>>
>>> Hi Chris,
>>>
>>> thanks for the response!
>>>
>>> That seems to work (see below).
>>>
>>> $ cd $BUILD_DIR
>>> $ grep -i lto CMakeCache.txt | grep ^[A-Z]
>>> [ OUTPUT ]
>>> LLVMLTO_LIB_DEPENDS:STATIC=
>>> LLVM_ENALBLE_LTO:UNINITIALIZED=ON
>>> LLVM_TOOL_LLVM_LTO_BUILD:BOOL=ON
>>> LLVM_TOOL_LTO_BUILD:BOOL=ON
>>> LTO_LIB_DEPENDS:STATIC=general;LLVMX86CodeGen;general;LLVMX86AsmPrinter;general;LLVMX86AsmParser;general;LLVMX86Desc;general;LLVMX86Info;general;LLVMX86Disassembler;general;LLVMCore;general;LLVMLTO;general;LLVMMC;general;LLVMMCDisassembler;general;LLVMSupport;general;LLVMTarget;
>>> COMPILER_RT_HAS_FNO_LTO_FLAG:INTERNAL=1
>>> LLVM_TOOL_LLVM_LTO_BUILD-ADVANCED:INTERNAL=1
>>> LLVM_TOOL_LTO_BUILD-ADVANCED:INTERNAL=1
>>> [ /OUTPUT ]
>>>
>>> But is no more documented in
>>> <http://llvm.org/releases/3.8.0/docs/CMake.html> or
>>> <http://llvm.org/docs/CMake.html>.
>>> I have seen LLVM_ENALBLE_LTO=On in some older docs.
>>> Bring it back?
>>> AFAICS, "cmake -LA | grep -i $pattern" die not show me this, but I
>>> might be wrong.
>>> ( Some weeks ago, I dealt with LTO/PGO. )
>>>
>>
>> OK, I got a typo, nevertheless LLVM_ENABLE_LTO does not work!
>>
>> [ ... ]
>> -- Configuring done
>> -- Generating done
>> CMake Warning:
>> Manually-specified variables were not used by the project:
>>
>> LLVM_ENABLE_LTO
>>
>>
>> -- Build files have been written to:
>> /home/wearefam/src/llvm-toolchain/llvm-build
>>
>> Do you need more input?
>>
>> Thanks!
>>
>
> I found in "http://llvmweekly.org/issue/110"
>
> [ llvm.src/cmake/modules/HandleLLVMOptions.cmake ]
>
> 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)
>
> Searching for...
>
> $ grep LLVM_ENABLE_LTO llvm/cmake/modules/HandleLLVMOptions.cmake
> [ OUTPUT EMPTY ]
>
> ...gives no output.
>
> So, LLVM_ENABLE_LTO is not available for LLVM/Clang v3.8.0?!
>
> Hmm, maybe I can backport (or git cherry-pick) SVN r259766.
>
> - Sedat -
>
> [1] http://llvmweekly.org/issue/110
> [2] http://reviews.llvm.org/rL259766
Backport-patch and v6 of my build-script attached.
- Sedat -
-------------- next part --------------
--- llvm.orig/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -635,6 +635,13 @@ append_if(LLVM_BUILD_INSTRUMENTED "-fpro
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)
--- llvm.orig/docs/CMake.rst
+++ 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build_llvm-toolchain_clang-cmake-ninja-gold_v6.sh
Type: application/x-sh
Size: 5264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160318/e369a606/attachment.sh>
More information about the llvm-dev
mailing list