From bf9612c1e6532d69d49163443c37355cd2f77fb3 Mon Sep 17 00:00:00 2001 From: "liang.he@intel.com" Date: Fri, 20 Mar 2026 11:16:30 +0800 Subject: [PATCH 1/4] feat: add --use-ccache CLI argument to build_llvm.py Add a new --use-ccache flag that will allow developers to opt-in to using ccache for LLVM builds. This is part of a larger effort to disable ccache by default to reduce CI storage consumption while still allowing local developers to benefit from faster incremental builds. Co-Authored-By: Claude Sonnet 4.5 --- build-scripts/build_llvm.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build-scripts/build_llvm.py b/build-scripts/build_llvm.py index 68ef640e39..0dec48d78c 100755 --- a/build-scripts/build_llvm.py +++ b/build-scripts/build_llvm.py @@ -270,6 +270,11 @@ def main(): action="store_true", help="use clang instead of gcc", ) + parser.add_argument( + "--use-ccache", + action="store_true", + help="enable ccache for faster incremental LLVM builds (disabled by default to reduce CI storage consumption, recommended for local development)", + ) parser.add_argument( "--extra-cmake-flags", type=str, From 89f34f12c70a048af6fbb96556ff89a0be320e96 Mon Sep 17 00:00:00 2001 From: "liang.he@intel.com" Date: Fri, 20 Mar 2026 11:31:13 +0800 Subject: [PATCH 2/4] feat: disable ccache by default, enable with --use-ccache flag This change modifies the LLVM build process to disable ccache by default and only enable it when the --use-ccache flag is explicitly passed. This reduces CI storage consumption while still allowing developers to opt-in to ccache for faster incremental builds. Changes: - Modified build_llvm() to accept use_ccache parameter (defaults to False) - Updated ccache logic to only enable when use_ccache=True and platform is not Windows - Pass options.use_ccache from main() to build_llvm() call Co-Authored-By: Claude Sonnet 4.5 --- build-scripts/build_llvm.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build-scripts/build_llvm.py b/build-scripts/build_llvm.py index 0dec48d78c..e2221b8e54 100755 --- a/build-scripts/build_llvm.py +++ b/build-scripts/build_llvm.py @@ -48,7 +48,7 @@ def query_llvm_version(llvm_info): return response['sha'] -def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_flags=''): +def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_flags='', use_ccache=False): LLVM_COMPILE_OPTIONS = [ '-DCMAKE_BUILD_TYPE:STRING="Release"', "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON", @@ -68,8 +68,8 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl "-DLLVM_OPTIMIZED_TABLEGEN:BOOL=ON", ] - # ccache is not available on Windows - if not "windows" == platform: + # ccache is opt-in via --use-ccache flag + if not "windows" == platform and use_ccache: LLVM_COMPILE_OPTIONS.append("-DLLVM_CCACHE_BUILD:BOOL=ON") # perf support is available on Linux only if "linux" == platform: @@ -339,7 +339,7 @@ def main(): if ( build_llvm( llvm_dir, platform, options.arch, options.project, options.use_clang, - options.extra_cmake_flags + options.extra_cmake_flags, options.use_ccache ) is not None ): From 299e926f0c935bb0f798ce7cbe5ebfe4089acc44 Mon Sep 17 00:00:00 2001 From: "liang.he@intel.com" Date: Fri, 20 Mar 2026 11:34:28 +0800 Subject: [PATCH 3/4] docs: add note about --use-ccache flag in product-mini README Co-Authored-By: Claude Sonnet 4.5 --- product-mini/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/product-mini/README.md b/product-mini/README.md index 65be5ce047..65c3dd00de 100644 --- a/product-mini/README.md +++ b/product-mini/README.md @@ -79,6 +79,12 @@ cd product-mini/platforms/linux/ ./build_llvm.sh (The llvm source code is cloned under /core/deps/llvm and auto built) ``` +Note: By default, ccache is disabled to reduce CI storage consumption. For local development with frequent LLVM rebuilds, you can enable ccache for faster incremental builds by using the `--use-ccache` flag: +``` Bash +cd /build-scripts +python3 build_llvm.py --arch X86 --use-ccache +``` + Then pass argument `-DWAMR_BUILD_JIT=1` to cmake to enable LLVM JIT: ``` Bash mkdir build && cd build From 064adffacd1c6455e8e04951ffcb50254b3b180f Mon Sep 17 00:00:00 2001 From: "liang.he@intel.com" Date: Fri, 20 Mar 2026 11:39:09 +0800 Subject: [PATCH 4/4] docs: update LLVM_CCACHE_BUILD example in benchmarks README Co-Authored-By: Claude Sonnet 4.5 --- tests/benchmarks/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/benchmarks/README.md b/tests/benchmarks/README.md index 95d85b1c09..6039363d35 100644 --- a/tests/benchmarks/README.md +++ b/tests/benchmarks/README.md @@ -65,3 +65,5 @@ cmake ../llvm \ ninja -j 8 # tool `llvm-profdata` is generated under this folder. ``` + +> **Note**: The example above shows `-DLLVM_CCACHE_BUILD:BOOL=ON` for enabling ccache in the cmake configuration. When using the `build_llvm.py` script, ccache is disabled by default to reduce CI storage consumption. To enable it with the script, use: `python3 build_llvm.py --use-ccache --arch X86`