Skip to content

Conversation

@alandefreitas
Copy link
Collaborator

Recent PR runs exceeded GitHub Actions cache limits, causing LLVM to be recompiled on every job of the workflow run. This led to hours-long turnaround times to verify changes. As a workaround, the fork workflow was being used to test the PR.

This commit simplifies the cache key structure to reduce redundant cache entries:

  • Add llvm-os-key using container name or runs-on for OS versioning
  • Make llvm-archive-basename conditional based on MSan only
  • Transform cache keys to replace ":" with "-" for safety
  • Only build instrumented libc++ for MSan where it's required

MSan requires all code, including libc++ to be instrumented to track initialization state correctly. ASan and UBSan can effectively catch errors without instrumenting dependencies, making custom libc++ builds low-ROI for these sanitizers.

Resulting cache key structure:

  • MSan builds: include compiler, version, and sanitizer type (e.g., llvm-dc4cef8-release-ubuntu-24.04-clang-21-MSan)
  • All other builds: omit compiler info since ABI is compatible (e.g., llvm-dc4cef8-release-ubuntu-24.04)

Non-sanitizer builds, ASan builds, and UBSan builds across gcc/clang versions on the same OS now share a single cache entry, as they produce ABI-compatible LLVM binaries.

Fixes #981

Recent PR runs exceeded GitHub Actions cache limits, causing LLVM to be recompiled on every workflow run. This led to hours-long turnaround times to verify changes. As a workaround, the fork workflow was being used to test the PR.

This commit simplifies the cache key structure to reduce redundant cache entries:

- Add `llvm-os-key` using container name or runs-on for OS versioning
- Make `llvm-archive-basename` conditional based on MSan only
- Transform cache keys to replace ":" with "-" for safety
- Only build instrumented libc++ for MSan where it's required

MSan requires all code, including libc++ to be instrumented to track initialization state correctly. ASan and UBSan can effectively catch errors without instrumenting dependencies, making custom libc++ builds low-ROI for these sanitizers.

Resulting cache key structure:
- MSan builds: include compiler, version, and sanitizer type
  (e.g., llvm-dc4cef8-release-ubuntu-24.04-clang-21-MSan)
- All other builds: omit compiler info since ABI is compatible
  (e.g., llvm-dc4cef8-release-ubuntu-24.04)

Non-sanitizer builds, ASan builds, and UBSan builds across gcc/clang versions on the same OS now share a single cache entry, as they produce ABI-compatible LLVM binaries.

Fixes cppalliance#981
@github-actions
Copy link

🚧 Danger.js checks for MrDocs are experimental; expect some rough edges while we tune the rules.

✨ Highlights

  • None noted.

🧾 Changes by Scope

Scope Lines Δ Lines + Lines - Files Δ Files + Files ~ Files ↔ Files -
⚙️ CI 18 13 5 1 - 1 - -
Total 18 13 5 1 - 1 - -

Legend: Files + (added), Files ~ (modified), Files ↔ (renamed), Files - (removed)

🔝 Top Files

  • .github/workflows/ci.yml (CI): 18 lines Δ (+13 / -5)

Generated by 🚫 dangerJS against 967f818

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +85 to +86
llvm-os-key: {{#if container}}{{{ container }}}{{else}}{{{ runs-on }}}{{/if}}
llvm-archive-basename: {{#if msan}}llvm-{{{ substr llvm-hash 0 7 }}}-{{{ llvm-build-preset-prefix }}}-{{{ llvm-os-key }}}-{{{ compiler }}}-{{{ version }}}-MSan{{else}}llvm-{{{ substr llvm-hash 0 7 }}}-{{{ llvm-build-preset-prefix }}}-{{{ llvm-os-key }}}{{/if}}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Sanitizer jobs now hit non-sanitized LLVM cache

The cache basename at this change no longer differentiates compiler or sanitizer, so ASan/UBSan matrix entries now use the same cache key as unsanitized Release builds. If any non-sanitized job primes the cache first, the later sanitizer jobs see a cache hit and skip Install LLVM (condition at lines 398–400), meaning they run against a release-built LLVM/libc++ instead of the requested LLVM_USE_SANITIZER instrumented build. Sanitizer coverage for LLVM and its runtimes therefore depends on job scheduling and can silently drop whenever a release build seeds the cache.

Useful? React with 👍 / 👎.

@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://1134.mrdocs.prtest2.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2025-12-17 10:12:42 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify redundant llvm cache keys

2 participants