Open
Description
I have noticed major performance regression during even CMake configure stage (where some tests are compiled and run to get compiler capabilities).
Stage 1. Compile LLVM 20.1.5 using system gcc.
Get LLVM 20.1.5 sources:
cd /tmp/projects/
wget -O llvm-project.src.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.5/llvm-project-20.1.5.src.tar.xz
tar -xf llvm-project.src.tar.xz
mv llvm-project*.src llvm_src
Configure (CMake version may be of your choice):
/tmp/programs/cmake/3.31.5/bin/cmake \
-S /tmp/projects/llvm_src/llvm/ \
-B /tmp/projects/llvm_build/ \
-G "Ninja" \
-DCMAKE_INSTALL_PREFIX=/tmp/programs/clang/20.1.5-gcc \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind"
Notice CMake configure time (for me is about 8.8 seconds).
Build:
/tmp/programs/cmake/3.31.5/bin/cmake \
--build /tmp/projects/llvm_build/ \
--target install -- -j $(nproc)
Now we have unoptimized (kinda) installation of LLVM 20.1.5.
Stage 2. Compile LLVM 20.1.5 using just built LLVM 20.1.5 with GCC
Configure:
/tmp/programs/cmake/3.31.5/bin/cmake \
-S /tmp/projects/llvm_src/llvm/ \
-B /tmp/projects/llvm_build/ \
-G "Ninja" \
-DCMAKE_INSTALL_PREFIX=/tmp/programs/clang/20.1.5 \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
-DCMAKE_C_COMPILER=/tmp/programs/clang/20.1.5-gcc/bin/clang \
-DCMAKE_CXX_COMPILER=/tmp/programs/clang/20.1.5-gcc/bin/clang++ \
-DLLVM_ENABLE_LLD=On
Notice CMake configure time significantly increased (for me is about 44 seconds now).
After LLVM is built, I tried to use it to build our project. Well, it failed even to build gRPC dependency for 1.5 hours utilizing 100% of CPU.
Configure time differences:
- 19.1.7:
- GCC: 9.6 seconds;
- LLVM 19.1.7: 14 seconds.
- 20.1.3:
- GCC: 8.8 seconds;
- LLVM 20.1.3: 12.5 seconds.
- 20.1.4:
- GCC: 9.1 seconds;
- LLVM 20.1.4: 12.7 seconds