[llvm] [libc] Include CPU model in overlay CI sccache key (PR #196477)

Jeff Bailey via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 00:23:18 PDT 2026


================
@@ -44,6 +44,31 @@ jobs:
     - uses: actions/checkout at de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
       with:
         persist-credentials: false
+
+    # The libc build uses -march=native for opt_host tests, which means
+    # the generated object files are specific to the runner's CPU model.
+    # sccache treats -march=native as a literal string in its cache key,
+    # so without per-CPU cache keys, object files compiled on one CPU
+    # model are silently served to runners with a different CPU, causing
+    # illegal instruction crashes at runtime.
+    - name: Detect CPU model
+      id: cpu-info
+      shell: bash
+      run: |
+        if [ "$RUNNER_OS" = "Linux" ]; then
+          # x86 has 'model name', ARM has 'CPU implementer' + 'CPU part'.
+          cpu_model=$(grep -m1 'model name' /proc/cpuinfo | cut -d: -f2 | xargs | tr ' ' '-' || true)
----------------
kaladron wrote:

If grep doesn't match anything, it gives an exit code of one that fails the whole build.  This allows it to continue. 

https://github.com/llvm/llvm-project/pull/196477


More information about the llvm-commits mailing list