[cfe-dev] Too much time to compile clang. Suggestions for a starter?

rNoz via cfe-dev cfe-dev at lists.llvm.org
Sat Oct 21 08:10:46 PDT 2017


Thank you very much, Jonas, Nicolas and Oleksii.

I read those blogs and applied just this:

cp ../../llvm-support/AddLLVM.cmake.gold ../cmake/modules/AddLLVM.cmake
(I modified those lines in the reviews.llvm.org).
CXX=clang++ CC=clang cmake LD=ld.gold -G Ninja .. -DLLVM_USE_LINKER=gold
-DBUILD_SHARED_LIBS=ON -DLLVM_USE_SPLIT_DWARF=ON
-DLLVM_OPTIMIZED_TABLEGEN=ON .. && ninja clang

And with just the same modification (int a = 22; in that class) I get
compiled/linked in JUST 10-3 SECONDS.

Impressive!

Thanks again. This thread can be closed.


On 21/10/17 15:27, Jonas Hahnfeld wrote:
> A few links that Google found in a simple search:
>  - this thread:
> http://lists.llvm.org/pipermail/llvm-dev/2016-October/106186.html
>  - https://llvm.org/devmtg/2015-04/slides/eurollvm-2015-build.pdf and
> these two blog posts:
> https://blogs.s-osg.org/an-introduction-to-accelerating-your-build-with-clang/
> and
> https://blogs.s-osg.org/a-conclusion-to-accelerating-your-build-with-clang/
>
> I personally took most of the advices from the last blog posts:
>  - Ninja, use Clang to build
>  - for Debug builds: -DBUILD_SHARED_LIBS=ON -DLLVM_USE_SPLIT_DWARF=ON
> -DLLVM_OPTIMIZED_TABLEGEN=ON
>
> Cheers,
> Jonas
>
> Am 2017-10-21 05:11, schrieb rNoz via cfe-dev:
>> I would like to start "touching" a bit the code, trying to create some
>> functionalities, but I have no idea where to start, and I will need
>> many trials/tests...
>>
>> So, one thing I was expecting is fast times to try
>> (Modify-Compile-Run).
>>
>> I did:
>>
>> make clang
>> and it needed like 3-4 hours. I am ok with that.
>>
>> Then, I add some "stupid" statement like 'int a = 3;' somewhere in
>> llvm/tools/clang/lib/Frontend/Rewrite/FixItRewriter.cpp
>> (FixitRewriter::Diag), and it needed:
>> - 6.57S. TO COMPILE THE TARGET ('MAKE CLANGREWRITEFRONTEND').
>> - 4MIN 36.36S TO LINK AND BUILD CLANG (`MAKE CLANG`).
>> In both cases it spends almost all the time LINKING (first to a static
>> lib, then to the clang binary itself).
>>
>> This is really a lot of time to try bit a bit without knowledge of the
>> whole clang, compiling process, etc. Waiting up to is just really time
>> consuming.
>>
>> What would you do to try the modifications faster?
>>
>> Any recomendation/blog/guide to follow as a starter trying to modify a
>> bit the codebase of clang?
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list