[llvm] r231842 - Add new LLVM_OPTIMIZED_TABLEGEN build setting which configures, builds and uses a release tablegen build when LLVM is configured with assertions enabled.

Chris Bieneman beanz at apple.com
Wed Mar 18 12:38:19 PDT 2015


> On Mar 18, 2015, at 12:34 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:
> 
> 
>> On Mar 18, 2015, at 12:11 PM, Chris Bieneman <beanz at apple.com> wrote:
>> 
>> Can you please provide steps to reproduce?
>> 
>> From the looks of it you aren’t building "Release+Asserts", you’re building “Unspecified+Asserts”, and the compile command you’re referencing doesn’t look like it is part of the cross compile, so it is expected that wouldn’t be optimized in an “Unspecified + Asserts” build.
>> 
>> Based on the information you’ve provided I see nothing that is unexpected.
> 
> $ egrep 'CMAKE_BUILD_TYPE|ENABLE_ASSER|OPTIMIZED' CMakeCache.txt 
> CMAKE_BUILD_TYPE:STRING=Release
> LLVM_ENABLE_ASSERTIONS:BOOL=ON
> LLVM_OPTIMIZED_TABLEGEN:BOOL=On
> 
> That does not look like “Unspecified” to me. 
> I had this build dir already, I didn’t start from scratch.
> 
> Trying from scratch again I don’t reproduce.
> I can see it happen again if I wipe out the NATIVE subdirectory and rerun ninja.
> 
> My impression is that if the NATIVE subdirectory is created while running cmake on the parent directory, it will be correctly create with CMAKE_BUILD_TYPE=RELEASE. 
> If does not exist when running ninja, it is created and configured without the parameters.

Sounds like you have a handle on the issue. Patches welcome :-).

-Chris

> 
>> Mehdi
> 
> 
> 
>> 
>> -Chris
>> 
>>> On Mar 18, 2015, at 11:57 AM, Mehdi Amini <mehdi.amini at apple.com> wrote:
>>> 
>>> Hi Chris,
>>> 
>>> On my “Release + Assert” build, I have the impression that LLVM_OPTIMIZED_TABLEGEN triggers llvm-tblgen to be built in the NATIVE subdirectory without optimization and  I’m not about Assert.
>>> 
>>> The cmake “config” phase displays:   "-- No build type selected, default to Debug”
>>> And the build phases does not show an optimization flags:
>>> /usr/local/Cellar/cmake/3.0.2/bin/cmake --build . --target llvm-tblgen --config Release -v
>>> […]
>>> /usr/bin/c++   -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -std=c++11 -fcolor-diagnostics -g -Ilib/Support -I/LLVM_PATH/lib/Support -Iinclude -I/LLVM_PATH/include    -fno-exceptions -fno-rtti -MMD -MT lib/Support/CMakeFiles/LLVMSupport.dir/MathExtras.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/MathExtras.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/MathExtras.cpp.o -c /LLVM_PATH/lib/Support/MathExtras.cpp
>>> 
>>> It defeats the point of this flag right now.
>>> 
>>> Did I miss something locally?
>>> 
>>> Thanks,
>>> 
>>> Mehdi
>>> 
>>> 
>>>> On Mar 10, 2015, at 1:48 PM, Chris Bieneman <beanz at apple.com> wrote:
>>>> 
>>>> Author: cbieneman
>>>> Date: Tue Mar 10 15:48:02 2015
>>>> New Revision: 231842
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=231842&view=rev
>>>> Log:
>>>> Add new LLVM_OPTIMIZED_TABLEGEN build setting which configures, builds and uses a release tablegen build when LLVM is configured with assertions enabled.
>>>> 
>>>> Summary: This change leverages the cross-compiling functionality in the build system to build a release tablegen executable for use during the build.
>>>> 
>>>> Reviewers: resistor, rnk
>>>> 
>>>> Reviewed By: rnk
>>>> 
>>>> Subscribers: rnk, joker.eph, llvm-commits
>>>> 
>>>> Differential Revision: http://reviews.llvm.org/D7349
>>>> 
>>>> Modified:
>>>> llvm/trunk/CMakeLists.txt
>>>> llvm/trunk/cmake/modules/TableGen.cmake
>>>> 
>>>> Modified: llvm/trunk/CMakeLists.txt
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=231842&r1=231841&r2=231842&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/CMakeLists.txt (original)
>>>> +++ llvm/trunk/CMakeLists.txt Tue Mar 10 15:48:02 2015
>>>> @@ -350,6 +350,11 @@ if(LLVM_DISABLE_LLVM_DYLIB_ATEXIT)
>>>> set(DISABLE_LLVM_DYLIB_ATEXIT 1)
>>>> endif()
>>>> 
>>>> +option(LLVM_OPTIMIZED_TABLEGEN "Force TableGen to be built with optimization" OFF)
>>>> +if(CMAKE_CROSSCOMPILING OR (LLVM_OPTIMIZED_TABLEGEN AND LLVM_ENABLE_ASSERTIONS))
>>>> +  set(LLVM_USE_HOST_TOOLS ON)
>>>> +endif()
>>>> +
>>>> # All options referred to from HandleLLVMOptions have to be specified
>>>> # BEFORE this include, otherwise options will not be correctly set on
>>>> # first cmake run
>>>> @@ -536,9 +541,9 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
>>>> include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR})
>>>> 
>>>> # when crosscompiling import the executable targets from a file
>>>> -if(CMAKE_CROSSCOMPILING)
>>>> +if(LLVM_USE_HOST_TOOLS)
>>>> include(CrossCompile)
>>>> -endif(CMAKE_CROSSCOMPILING)
>>>> +endif(LLVM_USE_HOST_TOOLS)
>>>> 
>>>> if( ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD )
>>>> # On FreeBSD, /usr/local/* is not used by default. In order to build LLVM
>>>> 
>>>> Modified: llvm/trunk/cmake/modules/TableGen.cmake
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=231842&r1=231841&r2=231842&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/cmake/modules/TableGen.cmake (original)
>>>> +++ llvm/trunk/cmake/modules/TableGen.cmake Tue Mar 10 15:48:02 2015
>>>> @@ -91,7 +91,7 @@ macro(add_tablegen target project)
>>>> # Effective tblgen executable to be used:
>>>> set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN} PARENT_SCOPE)
>>>> 
>>>> -  if(CMAKE_CROSSCOMPILING)
>>>> +  if(LLVM_USE_HOST_TOOLS)
>>>>  if( ${${project}_TABLEGEN} STREQUAL "${target}" )
>>>>    set(${project}_TABLEGEN_EXE "${LLVM_NATIVE_BUILD}/bin/${target}")
>>>>    set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN_EXE} PARENT_SCOPE)
>>>> 
>>>> 
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>> 
>> 
> 





More information about the llvm-commits mailing list