Upgrade rewrite gate clang-cl to 21.1.8; re-enable calc_fib and calc_sum_array#96
Merged
Upgrade rewrite gate clang-cl to 21.1.8; re-enable calc_fib and calc_sum_array#96
Conversation
5310ae0 to
9d7e5cf
Compare
30ea050 to
68c3cde
Compare
…array
The windows-latest preinstalled clang-cl (currently 20.1.8 at
`C:\Program Files\LLVM\bin\clang-cl.exe`) produces a lifter binary
that segfaults on calc_fib before emitting any IR, causing the rewrite
gate to fail. Clang 21.1.8 has been verified locally to compile the
lifter into a binary that lifts both calc_fib and calc_sum_array to
their expected constant returns (`ret i64 13` and `ret i64 150`).
Rolling back to clang 18.x is not an option: the runner image's MSVC STL
(14.44+) hard-requires clang 19.0.0 or newer via a static_assert in
yvals_core.h. Clang 21 satisfies that bound and dodges the clang 20.1.8
miscompile.
Upgrading via `choco upgrade llvm --version=21.1.8` keeps the existing
`C:\Program Files\LLVM\bin\clang-cl.exe` path valid, so the rest of
the pipeline (Resolve LLVM_DIR, Resolve clang-cl, Configure, Build) is
unchanged.
## Changes
- `.github/workflows/rewrite-strict-gate.yml`: add an "Upgrade clang-cl
to 21.1.8" step before `Resolve LLVM_DIR` that runs `choco upgrade
llvm` and pins `CMAKE_{C,CXX}_COMPILER` to the upgraded binary.
- `scripts/rewrite/instruction_microtests.json`: drop the `ci_skip`
entries on `calc_fib` and `calc_sum_array`.
- `docs/SCOPE.md`: bump the corpus counts to 33 samples / 177 runtime
semantic cases.
## Follow-up
Investigating the underlying clang 20.1.8 miscompile in the lifter is
still worth doing \u2014 it's almost certainly UB somewhere in the
structured-loop recovery path that clang 21 happens to tolerate. Tracked
separately.
68c3cde to
91020b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The windows-latest preinstalled clang-cl (currently 20.1.8 at
C:\Program Files\LLVM\bin\clang-cl.exe) produces a lifter binary that segfaults oncalc_fibbefore emitting any IR (ACCESS_VIOLATION 0xC0000005), causing the rewrite gates to fail whenevercalc_fiborcalc_sum_arrayis un-skipped. Clang 21.1.8 is verified locally to compile the lifter into a binary that lifts both samples to their expected constant returns.Why not downgrade to clang 18?
The runner image's MSVC STL (14.44.35207+) hard-requires clang 19.0.0 or newer via a
static_assertinyvals_core.h:Clang 18.1.8 cannot build any C++ TU that includes the STL on the current windows-latest image, so pinning to the same LLVM 18 version the lifter links against is not an option. Clang 21.1.8 is the lowest tested version that both satisfies the STL requirement and avoids the clang-20 miscompile.
Changes
.github/workflows/rewrite-strict-gate.yml: add anUpgrade clang-cl to 21.1.8step beforeResolve LLVM_DIRthat runschoco upgrade llvm --version=21.1.8and pinsCMAKE_{C,CXX}_COMPILERto the upgraded binary.scripts/rewrite/instruction_microtests.json: drop theci_skipentries oncalc_fibandcalc_sum_array.docs/SCOPE.md: bump the corpus counts to 33 samples / 177 runtime semantic cases.Verification
All CI checks pass on this branch (run 24089530699):
rewrite-quick-gate,rewrite-strict-gate,build (iced),build (zydis),windows-iced,windows-zydis.Follow-up
Investigating the underlying clang 20.1.8 miscompile in the lifter is still worth doing \u2014 it is almost certainly UB somewhere in the structured-loop recovery path that clang 21 happens to tolerate. Tracked separately.