From 6c6f4a97242017ada74071f947e6538d353d62b2 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 3 Sep 2022 15:44:53 +0200 Subject: [PATCH] llvm*: Fix core usage in tests lit (LLVM Integrated Tester) [0] by default uses as many threads as the build host has cores, ignoring the user's core settings for the build. This passes the configured core count on to lit, along with LLVM's default settings for it which we otherwise override in the process [1]. [0]: https://www.llvm.org/docs/CommandGuide/lit.html [1]: https://github.com/llvm/llvm-project/blob/329fda39c507e8740978d10458451dcdb21563be/llvm/CMakeLists.txt#L559-L565 --- pkgs/development/compilers/llvm/10/llvm/default.nix | 1 + pkgs/development/compilers/llvm/11/llvm/default.nix | 1 + pkgs/development/compilers/llvm/12/llvm/default.nix | 1 + pkgs/development/compilers/llvm/13/llvm/default.nix | 1 + pkgs/development/compilers/llvm/14/llvm/default.nix | 1 + pkgs/development/compilers/llvm/5/llvm/default.nix | 1 + pkgs/development/compilers/llvm/6/llvm/default.nix | 1 + pkgs/development/compilers/llvm/7/llvm/default.nix | 1 + pkgs/development/compilers/llvm/8/llvm/default.nix | 1 + pkgs/development/compilers/llvm/9/llvm/default.nix | 1 + pkgs/development/compilers/llvm/git/llvm/default.nix | 1 + 11 files changed, 11 insertions(+) diff --git a/pkgs/development/compilers/llvm/10/llvm/default.nix b/pkgs/development/compilers/llvm/10/llvm/default.nix index bb1b90b36a92..64e000fefdfd 100644 --- a/pkgs/development/compilers/llvm/10/llvm/default.nix +++ b/pkgs/development/compilers/llvm/10/llvm/default.nix @@ -179,6 +179,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_ENABLE_DUMP=ON" + "-DLLVM_LIT_ARGS=-svj\${NIX_BUILD_CORES}" ] ++ optionals enableManpages [ "-DLLVM_BUILD_DOCS=ON" "-DLLVM_ENABLE_SPHINX=ON" diff --git a/pkgs/development/compilers/llvm/11/llvm/default.nix b/pkgs/development/compilers/llvm/11/llvm/default.nix index a038795a4df1..214d6b05caff 100644 --- a/pkgs/development/compilers/llvm/11/llvm/default.nix +++ b/pkgs/development/compilers/llvm/11/llvm/default.nix @@ -181,6 +181,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_ENABLE_DUMP=ON" + "-DLLVM_LIT_ARGS=-svj\${NIX_BUILD_CORES}" ] ++ optionals stdenv.hostPlatform.isStatic [ # Disables building of shared libs, -fPIC is still injected by cc-wrapper "-DLLVM_ENABLE_PIC=OFF" diff --git a/pkgs/development/compilers/llvm/12/llvm/default.nix b/pkgs/development/compilers/llvm/12/llvm/default.nix index 435744b073f7..3428a1aa27c3 100644 --- a/pkgs/development/compilers/llvm/12/llvm/default.nix +++ b/pkgs/development/compilers/llvm/12/llvm/default.nix @@ -171,6 +171,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_ENABLE_DUMP=ON" + "-DLLVM_LIT_ARGS=-svj\${NIX_BUILD_CORES}" ] ++ optionals stdenv.hostPlatform.isStatic [ # Disables building of shared libs, -fPIC is still injected by cc-wrapper "-DLLVM_ENABLE_PIC=OFF" diff --git a/pkgs/development/compilers/llvm/13/llvm/default.nix b/pkgs/development/compilers/llvm/13/llvm/default.nix index 6372655b7ed4..8ab3cd74c56f 100644 --- a/pkgs/development/compilers/llvm/13/llvm/default.nix +++ b/pkgs/development/compilers/llvm/13/llvm/default.nix @@ -133,6 +133,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_ENABLE_DUMP=ON" + "-DLLVM_LIT_ARGS=-svj\${NIX_BUILD_CORES}" ] ++ optionals stdenv.hostPlatform.isStatic [ # Disables building of shared libs, -fPIC is still injected by cc-wrapper "-DLLVM_ENABLE_PIC=OFF" diff --git a/pkgs/development/compilers/llvm/14/llvm/default.nix b/pkgs/development/compilers/llvm/14/llvm/default.nix index 395f2b22b964..689358372ba3 100644 --- a/pkgs/development/compilers/llvm/14/llvm/default.nix +++ b/pkgs/development/compilers/llvm/14/llvm/default.nix @@ -144,6 +144,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_ENABLE_DUMP=ON" + "-DLLVM_LIT_ARGS=-svj\${NIX_BUILD_CORES}" ] ++ optionals stdenv.hostPlatform.isStatic [ # Disables building of shared libs, -fPIC is still injected by cc-wrapper "-DLLVM_ENABLE_PIC=OFF" diff --git a/pkgs/development/compilers/llvm/5/llvm/default.nix b/pkgs/development/compilers/llvm/5/llvm/default.nix index cf668cd566a6..720268e34afb 100644 --- a/pkgs/development/compilers/llvm/5/llvm/default.nix +++ b/pkgs/development/compilers/llvm/5/llvm/default.nix @@ -154,6 +154,7 @@ stdenv.mkDerivation (rec { "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DTARGET_TRIPLE=${stdenv.hostPlatform.config}" + "-DLLVM_LIT_ARGS=-svj\${NIX_BUILD_CORES}" ] ++ lib.optionals enableManpages [ "-DLLVM_BUILD_DOCS=ON" diff --git a/pkgs/development/compilers/llvm/6/llvm/default.nix b/pkgs/development/compilers/llvm/6/llvm/default.nix index 61f9234274d3..7bb82a999191 100644 --- a/pkgs/development/compilers/llvm/6/llvm/default.nix +++ b/pkgs/development/compilers/llvm/6/llvm/default.nix @@ -149,6 +149,7 @@ stdenv.mkDerivation (rec { "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly" "-DLLVM_ENABLE_DUMP=ON" + "-DLLVM_LIT_ARGS=-svj\${NIX_BUILD_CORES}" ] ++ optionals enableManpages [ "-DLLVM_BUILD_DOCS=ON" "-DLLVM_ENABLE_SPHINX=ON" diff --git a/pkgs/development/compilers/llvm/7/llvm/default.nix b/pkgs/development/compilers/llvm/7/llvm/default.nix index b324e1a0e4d6..5237d4383183 100644 --- a/pkgs/development/compilers/llvm/7/llvm/default.nix +++ b/pkgs/development/compilers/llvm/7/llvm/default.nix @@ -168,6 +168,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly" "-DLLVM_ENABLE_DUMP=ON" + "-DLLVM_LIT_ARGS=-svj\${NIX_BUILD_CORES}" ] ++ optionals enableManpages [ "-DLLVM_BUILD_DOCS=ON" "-DLLVM_ENABLE_SPHINX=ON" diff --git a/pkgs/development/compilers/llvm/8/llvm/default.nix b/pkgs/development/compilers/llvm/8/llvm/default.nix index efd1707eb337..383be10a17a6 100644 --- a/pkgs/development/compilers/llvm/8/llvm/default.nix +++ b/pkgs/development/compilers/llvm/8/llvm/default.nix @@ -161,6 +161,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_ENABLE_DUMP=ON" + "-DLLVM_LIT_ARGS=-svj\${NIX_BUILD_CORES}" ] ++ optionals enableManpages [ "-DLLVM_BUILD_DOCS=ON" "-DLLVM_ENABLE_SPHINX=ON" diff --git a/pkgs/development/compilers/llvm/9/llvm/default.nix b/pkgs/development/compilers/llvm/9/llvm/default.nix index 1dd1455ed6d6..1d9dfca7f142 100644 --- a/pkgs/development/compilers/llvm/9/llvm/default.nix +++ b/pkgs/development/compilers/llvm/9/llvm/default.nix @@ -176,6 +176,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_ENABLE_DUMP=ON" + "-DLLVM_LIT_ARGS=-svj\${NIX_BUILD_CORES}" ] ++ optionals enableManpages [ "-DLLVM_BUILD_DOCS=ON" "-DLLVM_ENABLE_SPHINX=ON" diff --git a/pkgs/development/compilers/llvm/git/llvm/default.nix b/pkgs/development/compilers/llvm/git/llvm/default.nix index fe6d650cdcd5..d161e664643f 100644 --- a/pkgs/development/compilers/llvm/git/llvm/default.nix +++ b/pkgs/development/compilers/llvm/git/llvm/default.nix @@ -130,6 +130,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_ENABLE_DUMP=ON" + "-DLLVM_LIT_ARGS=-svj\${NIX_BUILD_CORES}" ] ++ optionals stdenv.hostPlatform.isStatic [ # Disables building of shared libs, -fPIC is still injected by cc-wrapper "-DLLVM_ENABLE_PIC=OFF"