Skip to content

build: upgrade LLGo to LLVM 21 - #2334

Open
zhouguangyuan0718 wants to merge 28 commits into
xgo-dev:mainfrom
zhouguangyuan0718:codex/llvm21-upgrade
Open

build: upgrade LLGo to LLVM 21#2334
zhouguangyuan0718 wants to merge 28 commits into
xgo-dev:mainfrom
zhouguangyuan0718:codex/llvm21-upgrade

Conversation

@zhouguangyuan0718

@zhouguangyuan0718 zhouguangyuan0718 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • switch LLGo's default host LLVM, Clang, LLD, CI, development image, install documentation, and LTO plugin requirement from LLVM 19 to LLVM 21
  • use the revision-locked Espressif LLVM 21 payload 21.1.3_20260816 for release archives and automatic cross-toolchain downloads, with checked-in SHA-256 verification
  • use goplus/compiler-rt tag xtensa_release_21.1.3_20260408 for cross-runtime builds
  • fail fast when the linked LLVM library and command-line tools have different major versions
  • include LLVM/payload identity, target CPU/features, optimization level, and LTO mode in compiled cross-library cache keys
  • keep named-target CPU/features on the external clang/lld path and remove feature names no longer accepted by LLVM 21
  • update LLVM 21 IR spelling differences and require LLVM 21 for LLGOLTOPlugin
  • emit complete GNU Linux target triples so LLVM 21 Clang can discover Debian's vendor-less GCC and libstdc++ installation
  • remove the LLVM 19 compatibility lanes; this PR switches the supported/default LLGo toolchain in one step

Temporary Go LLVM dependency

Until xgo-dev/llvm#48 is merged and tagged, this branch temporarily replaces github.com/xgo-dev/llvm with the exact fork pseudo-version:

github.com/zhouguangyuan0718/go-llvm v0.0.0-20260827144345-45af6df6739a

That version resolves to PR head 45af6df6739a8be0168070ac35ab63170f1378e3, including the LLVMIsOpaqueStruct binding needed to preserve defined empty structs across LLVM contexts. After the binding release is available, the temporary replace will be removed and the normal github.com/xgo-dev/llvm requirement will be updated before merge.

Validation

  • rebased on current main (ff9bad850)
  • no LLVM build tag: go test passed for internal/dcepass, internal/llvmpayload, all internal/crosscompile/... packages, internal/build, internal/littest, ssa, and xtool/env/llvm, using the remotely downloadable fork pseudo-version
  • configured and built LLGOLTOPlugin.dylib against LLVM 21.1.8 with ccache
  • checked the generated payload contract: LLVM 21, payload 21.1.3_20260816, and all four published artifact digests
  • workflow YAML parsing and git diff --check
  • GitHub Actions passed the LLVM 21 main/compatibility, cross-compile, wasm, build-cache, LTO GlobalDCE, and Go Method Drop lanes on the previous head; on head 2e9d23ff6, the release build and Linux amd64/arm64 artifact smoke tests pass with complete GNU triples and no GCC-specific workaround, while the remaining matrix finishes

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review: LLVM 21 upgrade

Solid, well-tested change. The new internal/llvmpayload package cleanly centralizes the previously-scattered ESP Clang constants, SHA256 verification (Go and bash, verified before extraction, with cleanup on mismatch and a dedicated negative test) is a real integrity improvement, and the bash hardening (set -euo pipefail, trap cleanup, download-then-verify-then-extract) is correct and consistent with the Go path.

A few items are worth addressing before merge — most importantly whether the LLVM 21 payload/toolchain path is actually functional, and the platform-specific linker/compiler names in the new toolchain validator. See inline comments.

Findings that have no reliable inline location:

  • Docs still pin LLVM 19. ltoplugin/README.md (build instructions, -DLLVM_DIR=/path/to/llvm-19/..., and the "LLVM 19 ld64.lld" wording) still hard-codes LLVM 19 even though CMakeLists.txt now accepts 19.x or 21.x and internal/lto/lto.go was de-versioned to "the bundled ld64.lld". Similarly, README.md (generated from doc/_readme/scripts/install_macos.sh / install_ubuntu.sh) still installs only llvm@19/llvm-19 and does not mention the new toolchain-major validation requirement introduced by validateLLVMToolchain — a user who builds with -tags llvm21 but installs LLVM 19 tools will now hit "LLVM major version mismatch". Consider updating these docs (fix belongs in the doc/_readme/scripts/*.sh sources for the generated README).
  • WASI SDK download remains unverified (pre-existing, low). Now that the checksum plumbing exists (downloadAndExtractArchiveWithChecksum), the WASI SDK download still passes an empty checksum and skips verification. Not introduced here, but a natural candidate to pin next since this PR is about hardening this path.

Comment on lines +33 to +44
var manifests = map[int]manifest{
19: {
llvmMajor: 19,
version: "19.1.2_20250905-3",
sha256: map[string]string{
"aarch64-apple-darwin": "4f15d18c93eabdace3eab901582e528ac334d328fb8f19f153ee55b2208d101b",
"aarch64-linux-gnu": "b2d8e77bbf3394c6a1f0d66e59385d78d2b49b97ebe782e612cba7f93dcb2337",
"x86_64-apple-darwin": "e4f329a911e813ee825984f039578614dc0fe69001c2afe3e61edf27821be3ad",
"x86_64-linux-gnu": "e2e0c48cd76e45ceba910917a2a97988dc80e3bb6040ea262bfe9293d5d9ac57",
},
},
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P1] No LLVM 21 payload: ESP cross-compile fails under -tags llvm21

This PR adds llvm21 build-tag config files and widens the LTO plugin to accept LLVM 21, but manifests contains only the 19 entry and DefaultMajor is still 19. When LLGo is built with -tags llvm21, gllvm.Version reports 21.x, so getESPClangRoot -> llvmpayload.ForLLVMVersion("21...") -> ForMajor(21) returns "no LLGo LLVM payload for major version 21" (crosscompile.go:141-144), and any ESP/cross-compile build on an LLVM 21 toolchain fails.

If the LLVM 21 ESP payload simply is not published yet and 19-only downloads are intentional for now, that is fine — but it should be documented, and the package doc comment ("toolchains distributed with and downloaded by LLGo", ForLLVMVersion example 21.1.8) overstates availability. As written, the headline "upgrade to LLVM 21" is not functional for the ESP download path.

Comment thread internal/build/build.go
Comment on lines +415 to +417
if err := validateLLVMToolchain(export); err != nil {
return nil, fmt.Errorf("invalid LLVM toolchain: %w", err)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] validateLLVMToolchain runs 3 uncached --version subprocesses on every Build

Build now unconditionally calls validateLLVMToolchain, which spawns three subprocesses (llvm-config, clang/export.CC, ld.lld) via exec.Command(tool, "--version"). For a one-shot llgo build this is negligible. But in-process, high-fan-out drivers (the cltest harness, go test suites that call Build/Do once per package) will spawn hundreds x 3 --version processes per run, all producing the same answer since gllvm.Version and the toolchain paths are constant for the process lifetime. Consider memoizing the result per (linkedVersion, toolPath) in ValidateToolchainMajor so repeated Build calls pay the cost once.

Comment on lines +108 to +121
func PlatformSuffix(goos, goarch string) (string, bool) {
switch goos + "/" + goarch {
case "darwin/amd64":
return "x86_64-apple-darwin", true
case "darwin/arm64":
return "aarch64-apple-darwin", true
case "linux/amd64":
return "x86_64-linux-gnu", true
case "linux/arm64":
return "aarch64-linux-gnu", true
default:
return "", false
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] PlatformSuffix drops linux/arm and windows/amd64 mappings

The refactored getESPClangPlatform now delegates to PlatformSuffix, which only maps darwin/linux amd64/arm64. The previous inline switch also handled linux/arm (arm-linux-gnueabihf) and windows/amd64 (x86_64-w64-mingw32). If any target config or CI relied on those, the download path now returns "" -> "platform ... is not supported for download". If the removal is intentional (those payloads never shipped), please confirm; otherwise it is a regression.

Comment on lines +32 to +33
fmt.Printf("LLGO_LLVM_MAJOR=%s\n", fmt.Sprint(manifest.LLVMMajor()))
fmt.Printf("ESP_CLANG_LLVM_MAJOR=%s\n", fmt.Sprint(manifest.LLVMMajor()))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P3] Unnecessary fmt.Sprint on int; use %d

LLVMMajor() returns int; fmt.Printf("...=%s\n", fmt.Sprint(manifest.LLVMMajor())) formats an int to string then re-formats as %s. Use %d directly. Also note the mixed error handling below: a missing platform mapping panics while a missing artifact does os.Exit(1). For a CLI feeding $GITHUB_ENV, prefer the stderr + os.Exit(1) form for both so CI failures are readable without a Go stack trace.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review (supplemental)

One additional inline finding from the LLVM 21 review; see comment.

Comment thread internal/build/build.go
Comment on lines +805 to +811
func validateLLVMToolchain(export crosscompile.Export) error {
if export.ClangRoot != "" {
binDir := filepath.Join(export.ClangRoot, "bin")
return envllvm.ValidateToolchainMajor(gllvm.Version,
filepath.Join(binDir, "llvm-config"),
filepath.Join(binDir, "clang"),
filepath.Join(binDir, "ld.lld"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P1] Toolchain validator hardcodes ld.lld/clang (breaks darwin/windows)

validateLLVMToolchain always probes ld.lld, but the linker is platform-specific: darwin toolchains ship ld64.lld and windows uses lld-link (crosscompile.go:290,295). ClangRoot is set to the ESP Clang bundle for darwin and linux hosts, so on macOS filepath.Join(binDir, "ld.lld") does not exist and ValidateToolchainMajor fails with query LLVM tool ... ld.lld ... no such file, aborting the build on exactly the darwin release path this PR cares about.

Also, the ClangRoot branch probes filepath.Join(binDir, "clang"), but the bundle and export.CC only guarantee clang++ (crosscompile.go:217). Prefer validating export.CC and deriving the linker name from the target GOOS (mirroring the crosscompile linker logic) instead of hardcoding ld.lld/clang.

@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.68599% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/llvmpayload/cmd/llvmpayload/main.go 86.48% 5 Missing ⚠️
internal/build/build.go 88.23% 2 Missing ⚠️
internal/crosscompile/crosscompile.go 92.85% 2 Missing ⚠️
internal/crosscompile/fetch.go 94.44% 1 Missing ⚠️
internal/crosscompile/libc.go 97.61% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown

LLGo baseline benchmarks

eaf8037ef6bb | workflow run | long-term charts

Program measurements

Platform Workload File size vs base Text size vs base Build vs base Run vs base
Linux cprintf 19608 B 0 B / +0.0% 387 B 0 B / +0.0% 380.489 ms +32.46 ms / +9.3% (worse) 1.296 ms +43.87 us / +3.5% (worse)
Linux cprintf-lto 19440 B 0 B / +0.0% 368 B 0 B / +0.0% 374.990 ms +30.7 ms / +8.9% (worse) 1.381 ms +68.49 us / +5.2% (worse)
Linux fmtprintf 1613536 B -8 B / -0.0004958% (better) 491302 B 0 B / +0.0% 2.545 s +11.42 ms / +0.5% (worse) 2.930 ms -14.29 us / -0.5% (better)
Linux fmtprintf-lto 1501760 B -8 B / -0.0005327% (better) 463651 B 0 B / +0.0% 8.822 s +121.9 ms / +1.4% (worse) 2.812 ms -110.8 us / -3.8% (better)
Linux println 62824 B 0 B / +0.0% 15431 B 0 B / +0.0% 379.661 ms +45.44 ms / +13.6% (worse) 1.645 ms +60.02 us / +3.8% (worse)
Linux println-lto 54728 B 0 B / +0.0% 12971 B 0 B / +0.0% 567.997 ms +44.71 ms / +8.5% (worse) 1.589 ms -34.51 us / -2.1% (better)
macOS cprintf 84480 B 0 B / +0.0% 16845 B 0 B / +0.0% 581.836 ms +193.3 ms / +49.7% (worse) 3.393 ms +810.9 us / +31.4% (worse)
macOS cprintf-lto 100704 B 0 B / +0.0% 16825 B 0 B / +0.0% 501.603 ms -40.22 ms / -7.4% (better) 2.792 ms -1.437 ms / -34.0% (better)
macOS fmtprintf 1473232 B 0 B / +0.0% 869648 B 0 B / +0.0% 2.157 s -509.5 ms / -19.1% (better) 4.376 ms -48.67 us / -1.1% (better)
macOS fmtprintf-lto 1208832 B 0 B / +0.0% 883660 B 0 B / +0.0% 6.218 s -2.571 s / -29.3% (better) 4.839 ms -2.997 ms / -38.2% (better)
macOS println 114944 B 0 B / +0.0% 35649 B 0 B / +0.0% 474.839 ms -149.7 ms / -24.0% (better) 3.818 ms -89.58 us / -2.3% (better)
macOS println-lto 118736 B 0 B / +0.0% 33357 B 0 B / +0.0% 605.259 ms -189.9 ms / -23.9% (better) 3.208 ms -1.373 ms / -30.0% (better)
Windows MinGW cprintf 19968 B 0 B / +0.0% 4662 B 0 B / +0.0% 882.339 ms +41.91 ms / +5.0% (worse) 3.391 ms -271.9 us / -7.4% (better)
Windows MinGW cprintf-lto 17920 B 0 B / +0.0% 4582 B 0 B / +0.0% 900.757 ms +51.16 ms / +6.0% (worse) 3.422 ms -428.1 us / -11.1% (better)
Windows MinGW fmtprintf 1886720 B 0 B / +0.0% 595734 B 0 B / +0.0% 3.457 s +69.6 ms / +2.1% (worse) 8.316 ms +197.5 us / +2.4% (worse)
Windows MinGW fmtprintf-lto 1999360 B 0 B / +0.0% 599750 B 0 B / +0.0% 9.615 s +48.35 ms / +0.5% (worse) 7.820 ms +79.9 us / +1.0% (worse)
Windows MinGW println 72704 B 0 B / +0.0% 25078 B 0 B / +0.0% 880.711 ms +43.21 ms / +5.2% (worse) 6.168 ms -698.8 us / -10.2% (better)
Windows MinGW println-lto 66560 B 0 B / +0.0% 21734 B 0 B / +0.0% 1.087 s +48.11 ms / +4.6% (worse) 6.432 ms -477.5 us / -6.9% (better)
Windows MinGW 386 cprintf 36864 B 0 B / +0.0% 5368 B 0 B / +0.0% 640.858 ms -13.82 ms / -2.1% (better) 3.060 ms -14.7 us / -0.5% (better)
Windows MinGW 386 cprintf-lto 20992 B 0 B / +0.0% 5152 B 0 B / +0.0% 694.409 ms +116.5 ms / +20.2% (worse) 3.065 ms +10.6 us / +0.3% (worse)
Windows MinGW 386 fmtprintf 1845248 B 0 B / +0.0% 471044 B 0 B / +0.0% 2.476 s +106.1 ms / +4.5% (worse) 6.794 ms -132.5 us / -1.9% (better)
Windows MinGW 386 fmtprintf-lto 2292736 B 0 B / +0.0% 506552 B 0 B / +0.0% 6.370 s +77.77 ms / +1.2% (worse) 6.611 ms -857.1 us / -11.5% (better)
Windows MinGW 386 println 88064 B 0 B / +0.0% 21328 B 0 B / +0.0% 549.827 ms -86.83 ms / -13.6% (better) 5.135 ms -158.3 us / -3.0% (better)
Windows MinGW 386 println-lto 71680 B 0 B / +0.0% 19288 B 0 B / +0.0% 703.713 ms +20.73 ms / +3.0% (worse) 5.260 ms -101.8 us / -1.9% (better)
Windows MinGW ARM64 cprintf 19456 B 0 B / +0.0% 4632 B 0 B / +0.0% 1.183 s +145 ms / +14.0% (worse) 7.321 ms +496.6 us / +7.3% (worse)
Windows MinGW ARM64 cprintf-lto 17920 B 0 B / +0.0% 4552 B 0 B / +0.0% 1.219 s +173.6 ms / +16.6% (worse) 7.211 ms +335.7 us / +4.9% (worse)
Windows MinGW ARM64 fmtprintf 1776128 B 0 B / +0.0% 510232 B 0 B / +0.0% 3.635 s +188.6 ms / +5.5% (worse) 13.320 ms -872.9 us / -6.2% (better)
Windows MinGW ARM64 fmtprintf-lto 1930752 B 0 B / +0.0% 534644 B 0 B / +0.0% 9.256 s +61.29 ms / +0.7% (worse) 14.252 ms +1.47 ms / +11.5% (worse)
Windows MinGW ARM64 println 70656 B 0 B / +0.0% 24128 B 0 B / +0.0% 1.138 s +103.7 ms / +10.0% (worse) 11.870 ms -129.5 us / -1.1% (better)
Windows MinGW ARM64 println-lto 66048 B 0 B / +0.0% 21464 B 0 B / +0.0% 1.344 s +114.5 ms / +9.3% (worse) 11.838 ms -316.1 us / -2.6% (better)
Windows MSVC cprintf 120320 B 0 B / +0.0% 65782 B 0 B / +0.0% 795.138 ms +43.95 ms / +5.9% (worse) 3.396 ms -51.5 us / -1.5% (better)
Windows MSVC cprintf-lto 119808 B 0 B / +0.0% 65718 B 0 B / +0.0% 819.132 ms +48.01 ms / +6.2% (worse) 3.333 ms -88.6 us / -2.6% (better)
Windows MSVC fmtprintf 1616896 B 0 B / +0.0% 691094 B 0 B / +0.0% 3.336 s -46.62 ms / -1.4% (better) 9.605 ms -249.4 us / -2.5% (better)
Windows MSVC fmtprintf-lto 1685504 B 0 B / +0.0% 701366 B 0 B / +0.0% 8.780 s -489.3 ms / -5.3% (better) 10.263 ms -487.6 us / -4.5% (better)
Windows MSVC println 194048 B 0 B / +0.0% 120390 B 0 B / +0.0% 773.342 ms -109.5 ms / -12.4% (better) 7.266 ms -4.136 ms / -36.3% (better)
Windows MSVC println-lto 190976 B 0 B / +0.0% 117478 B 0 B / +0.0% 951.232 ms -9.779 ms / -1.0% (better) 7.722 ms -459 us / -5.6% (better)
Windows MSVC 386 cprintf 9728 B 0 B / +0.0% 3930 B 0 B / +0.0% 827.283 ms +5.059 ms / +0.6% (worse) 5.986 ms +459.6 us / +8.3% (worse)
Windows MSVC 386 cprintf-lto 9216 B 0 B / +0.0% 3840 B 0 B / +0.0% 851.286 ms +16.44 ms / +2.0% (worse) 5.519 ms +280 us / +5.3% (worse)
Windows MSVC 386 fmtprintf 1188864 B 0 B / +0.0% 454800 B 0 B / +0.0% 3.422 s +37.37 ms / +1.1% (worse) 11.766 ms +641.4 us / +5.8% (worse)
Windows MSVC 386 fmtprintf-lto 1307648 B 0 B / +0.0% 488053 B 0 B / +0.0% 8.581 s +89.44 ms / +1.1% (worse) 11.304 ms -518.8 us / -4.4% (better)
Windows MSVC 386 println 35840 B 0 B / +0.0% 20160 B 0 B / +0.0% 813.777 ms +10.75 ms / +1.3% (worse) 9.590 ms +239.7 us / +2.6% (worse)
Windows MSVC 386 println-lto 34304 B 0 B / +0.0% 18327 B 0 B / +0.0% 990.900 ms +6.134 ms / +0.6% (worse) 9.727 ms -699.9 us / -6.7% (better)
Windows MSVC ARM64 cprintf 11264 B 0 B / +0.0% 3976 B 0 B / +0.0% 1.785 s +32.12 ms / +1.8% (worse) 7.401 ms -863.4 us / -10.4% (better)
Windows MSVC ARM64 cprintf-lto 10752 B 0 B / +0.0% 3844 B 0 B / +0.0% 1.756 s +26.48 ms / +1.5% (worse) 7.429 ms -691.1 us / -8.5% (better)
Windows MSVC ARM64 fmtprintf 1364992 B 0 B / +0.0% 509772 B 0 B / +0.0% 5.743 s -457.2 ms / -7.4% (better) 16.251 ms +262.6 us / +1.6% (worse)
Windows MSVC ARM64 fmtprintf-lto 1464832 B 0 B / +0.0% 538028 B 0 B / +0.0% 15.801 s +335.8 ms / +2.2% (worse) 15.714 ms -757.1 us / -4.6% (better)
Windows MSVC ARM64 println 43520 B 0 B / +0.0% 23336 B 0 B / +0.0% 1.742 s +45.95 ms / +2.7% (worse) 13.364 ms -1.352 ms / -9.2% (better)
Windows MSVC ARM64 println-lto 41472 B 0 B / +0.0% 21180 B 0 B / +0.0% 2.065 s +68.7 ms / +3.4% (worse) 13.398 ms -2.091 ms / -13.5% (better)
Core language and compiler benchmarks
Platform Benchmark ns/op vs base
Linux BenchmarkLookupPCRandom 13.430 ns/op +0.02 ns/op / +0.1% (worse)
Linux BenchmarkMergeCompilerFlags 140.600 ns/op 0 ns/op / +0.0%
Linux BenchmarkMergeLinkerFlags 89.330 ns/op -1.73 ns/op / -1.9% (better)
Linux BenchmarkChannelBuffered 39.590 ns/op -0.05 ns/op / -0.1% (better)
Linux BenchmarkChannelHandoff 26372 ns/op -986 ns/op / -3.6% (better)
Linux BenchmarkDefer 45.770 ns/op -1.74 ns/op / -3.7% (better)
Linux BenchmarkDirectCall 1.556 ns/op -0.001 ns/op / -0.1% (better)
Linux BenchmarkGlobalRead 1.559 ns/op +0.001 ns/op / +0.1% (worse)
Linux BenchmarkGlobalWrite 2.489 ns/op +0.003 ns/op / +0.1% (worse)
Linux BenchmarkGoroutine 40757 ns/op -1260 ns/op / -3.0% (better)
Linux BenchmarkInterfaceCall 8.406 ns/op -0.006 ns/op / -0.1% (better)
Linux BenchmarkRuntimeGetG 2.182 ns/op +0.002 ns/op / +0.1% (worse)
macOS BenchmarkLookupPCRandom 12.820 ns/op -4.44 ns/op / -25.7% (better)
macOS BenchmarkMergeCompilerFlags 108.200 ns/op -69.4 ns/op / -39.1% (better)
macOS BenchmarkMergeLinkerFlags 70.250 ns/op -49.65 ns/op / -41.4% (better)
macOS BenchmarkChannelBuffered 25.160 ns/op -1.53 ns/op / -5.7% (better)
macOS BenchmarkChannelHandoff 5508 ns/op -3600 ns/op / -39.5% (better)
macOS BenchmarkDefer 33.400 ns/op +0.45 ns/op / +1.4% (worse)
macOS BenchmarkDirectCall 1.159 ns/op +0.081 ns/op / +7.5% (worse)
macOS BenchmarkGlobalRead 1.066 ns/op -0.014 ns/op / -1.3% (better)
macOS BenchmarkGlobalWrite 1.073 ns/op +0.002 ns/op / +0.2% (worse)
macOS BenchmarkGoroutine 25612 ns/op -4143 ns/op / -13.9% (better)
macOS BenchmarkInterfaceCall 4.644 ns/op -0.017 ns/op / -0.4% (better)
macOS BenchmarkRuntimeGetG 2.219 ns/op -0.084 ns/op / -3.6% (better)
Windows MinGW BenchmarkLookupPCRandom 13.060 ns/op +0.01 ns/op / +0.1% (worse)
Windows MinGW BenchmarkMergeCompilerFlags 608.100 ns/op +0.6 ns/op / +0.1% (worse)
Windows MinGW BenchmarkMergeLinkerFlags 514.800 ns/op -18.3 ns/op / -3.4% (better)
Windows MinGW BenchmarkChannelBuffered 36.540 ns/op +0.57 ns/op / +1.6% (worse)
Windows MinGW BenchmarkChannelHandoff 875.300 ns/op +21.7 ns/op / +2.5% (worse)
Windows MinGW BenchmarkDefer 55.600 ns/op +0.33 ns/op / +0.6% (worse)
Windows MinGW BenchmarkDirectCall 1.548 ns/op +0.001 ns/op / +0.1% (worse)
Windows MinGW BenchmarkGlobalRead 1.547 ns/op -0.001 ns/op / -0.1% (better)
Windows MinGW BenchmarkGlobalWrite 2.469 ns/op -0.001 ns/op / -0.04049% (better)
Windows MinGW BenchmarkGoroutine 82647 ns/op -2244 ns/op / -2.6% (better)
Windows MinGW BenchmarkInterfaceCall 9.002 ns/op +0.02 ns/op / +0.2% (worse)
Windows MinGW BenchmarkRuntimeGetG 2.790 ns/op -0.004 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkLookupPCRandom 14.890 ns/op +0.02 ns/op / +0.1% (worse)
Windows MinGW 386 BenchmarkMergeCompilerFlags 641.400 ns/op -17 ns/op / -2.6% (better)
Windows MinGW 386 BenchmarkMergeLinkerFlags 843 ns/op +181.6 ns/op / +27.5% (worse)
Windows MinGW 386 BenchmarkChannelBuffered 41.620 ns/op +0.06 ns/op / +0.1% (worse)
Windows MinGW 386 BenchmarkChannelHandoff 630.600 ns/op -70.1 ns/op / -10.0% (better)
Windows MinGW 386 BenchmarkDefer 25.190 ns/op -1.4 ns/op / -5.3% (better)
Windows MinGW 386 BenchmarkDirectCall 0.887 ns/op +0.0014 ns/op / +0.2% (worse)
Windows MinGW 386 BenchmarkGlobalRead 0.886 ns/op +0.0009 ns/op / +0.1% (worse)
Windows MinGW 386 BenchmarkGlobalWrite 7.958 ns/op -0.001 ns/op / -0.01256% (better)
Windows MinGW 386 BenchmarkGoroutine 40355 ns/op +438 ns/op / +1.1% (worse)
Windows MinGW 386 BenchmarkInterfaceCall 5.537 ns/op -0.001 ns/op / -0.01806% (better)
Windows MinGW 386 BenchmarkRuntimeGetG 0.997 ns/op +0.0337 ns/op / +3.5% (worse)
Windows MinGW ARM64 BenchmarkLookupPCRandom 12.040 ns/op -0.03 ns/op / -0.2% (better)
Windows MinGW ARM64 BenchmarkMergeCompilerFlags 576.900 ns/op +4 ns/op / +0.7% (worse)
Windows MinGW ARM64 BenchmarkMergeLinkerFlags 541.100 ns/op +15.8 ns/op / +3.0% (worse)
Windows MinGW ARM64 BenchmarkChannelBuffered 43.940 ns/op -2.53 ns/op / -5.4% (better)
Windows MinGW ARM64 BenchmarkChannelHandoff 2384 ns/op +92 ns/op / +4.0% (worse)
Windows MinGW ARM64 BenchmarkDefer 51.780 ns/op -2.46 ns/op / -4.5% (better)
Windows MinGW ARM64 BenchmarkDirectCall 0.663 ns/op +0.0001 ns/op / +0.01507% (worse)
Windows MinGW ARM64 BenchmarkGlobalRead 0.593 ns/op -0.0007 ns/op / -0.1% (better)
Windows MinGW ARM64 BenchmarkGlobalWrite 0.664 ns/op +0.0005 ns/op / +0.1% (worse)
Windows MinGW ARM64 BenchmarkGoroutine 62398 ns/op +141 ns/op / +0.2% (worse)
Windows MinGW ARM64 BenchmarkInterfaceCall 4.891 ns/op +0.008 ns/op / +0.2% (worse)
Windows MinGW ARM64 BenchmarkRuntimeGetG 1.774 ns/op -0.028 ns/op / -1.6% (better)
Windows MSVC BenchmarkLookupPCRandom 12.510 ns/op +0.14 ns/op / +1.1% (worse)
Windows MSVC BenchmarkMergeCompilerFlags 555.100 ns/op +21.8 ns/op / +4.1% (worse)
Windows MSVC BenchmarkMergeLinkerFlags 471.200 ns/op +6.1 ns/op / +1.3% (worse)
Windows MSVC BenchmarkChannelBuffered 39.700 ns/op +0.02 ns/op / +0.1% (worse)
Windows MSVC BenchmarkChannelHandoff 1237 ns/op +119 ns/op / +10.6% (worse)
Windows MSVC BenchmarkDefer 57.420 ns/op -0.69 ns/op / -1.2% (better)
Windows MSVC BenchmarkDirectCall 1.746 ns/op -0.002 ns/op / -0.1% (better)
Windows MSVC BenchmarkGlobalRead 1.746 ns/op -0.002 ns/op / -0.1% (better)
Windows MSVC BenchmarkGlobalWrite 2.792 ns/op +0.005 ns/op / +0.2% (worse)
Windows MSVC BenchmarkGoroutine 63506 ns/op -13475 ns/op / -17.5% (better)
Windows MSVC BenchmarkInterfaceCall 10.140 ns/op -0.02 ns/op / -0.2% (better)
Windows MSVC BenchmarkRuntimeGetG 2.099 ns/op -0.003 ns/op / -0.1% (better)
Windows MSVC 386 BenchmarkLookupPCRandom 26.520 ns/op +0.01 ns/op / +0.03772% (worse)
Windows MSVC 386 BenchmarkMergeCompilerFlags 776.100 ns/op +4 ns/op / +0.5% (worse)
Windows MSVC 386 BenchmarkMergeLinkerFlags 709.500 ns/op +21.9 ns/op / +3.2% (worse)
Windows MSVC 386 BenchmarkChannelBuffered 43.730 ns/op -1.44 ns/op / -3.2% (better)
Windows MSVC 386 BenchmarkChannelHandoff 1143 ns/op +6 ns/op / +0.5% (worse)
Windows MSVC 386 BenchmarkDefer 49.230 ns/op +0.99 ns/op / +2.1% (worse)
Windows MSVC 386 BenchmarkDirectCall 1.546 ns/op -0.003 ns/op / -0.2% (better)
Windows MSVC 386 BenchmarkGlobalRead 1.859 ns/op 0 ns/op / +0.0%
Windows MSVC 386 BenchmarkGlobalWrite 7.770 ns/op -0.006 ns/op / -0.1% (better)
Windows MSVC 386 BenchmarkGoroutine 87160 ns/op -2424 ns/op / -2.7% (better)
Windows MSVC 386 BenchmarkInterfaceCall 9.957 ns/op +0.024 ns/op / +0.2% (worse)
Windows MSVC 386 BenchmarkRuntimeGetG 2.165 ns/op -0.001 ns/op / -0.04617% (better)
Windows MSVC ARM64 BenchmarkLookupPCRandom 12.100 ns/op +0.08 ns/op / +0.7% (worse)
Windows MSVC ARM64 BenchmarkMergeCompilerFlags 582.200 ns/op +11.5 ns/op / +2.0% (worse)
Windows MSVC ARM64 BenchmarkMergeLinkerFlags 547.200 ns/op +7 ns/op / +1.3% (worse)
Windows MSVC ARM64 BenchmarkChannelBuffered 43.920 ns/op -3.57 ns/op / -7.5% (better)
Windows MSVC ARM64 BenchmarkChannelHandoff 2302 ns/op -186 ns/op / -7.5% (better)
Windows MSVC ARM64 BenchmarkDefer 67.760 ns/op -0.68 ns/op / -1.0% (better)
Windows MSVC ARM64 BenchmarkDirectCall 0.664 ns/op -0.0008 ns/op / -0.1% (better)
Windows MSVC ARM64 BenchmarkGlobalRead 0.590 ns/op -0.0019 ns/op / -0.3% (better)
Windows MSVC ARM64 BenchmarkGlobalWrite 3.748 ns/op -0.008 ns/op / -0.2% (better)
Windows MSVC ARM64 BenchmarkGoroutine 56664 ns/op +1151 ns/op / +2.1% (worse)
Windows MSVC ARM64 BenchmarkInterfaceCall 4.722 ns/op +0.002 ns/op / +0.04237% (worse)
Windows MSVC ARM64 BenchmarkRuntimeGetG 1.770 ns/op -0.029 ns/op / -1.6% (better)

Timer runtime benchmarks

Platform Operation and runtime ns/op vs base
Linux AfterFuncZeroDelivery/Go 606.100 ns/op -5.2 ns/op / -0.9% (better)
Linux AfterFuncZeroDelivery/LLGo 54181 ns/op +225 ns/op / +0.4% (worse)
Linux CreateStop/Go 149 ns/op +1.4 ns/op / +0.9% (worse)
Linux CreateStop/LLGo 709.900 ns/op -163.3 ns/op / -18.7% (better)
Linux RearmStopped/Go 55.320 ns/op +0.29 ns/op / +0.5% (worse)
Linux RearmStopped/LLGo 897.200 ns/op +229.1 ns/op / +34.3% (worse)
Linux ResetActive/Go 41.740 ns/op +0.12 ns/op / +0.3% (worse)
Linux ResetActive/LLGo 408.600 ns/op -0.5 ns/op / -0.1% (better)
Linux ResetHeap1024/Go 41.660 ns/op +0.14 ns/op / +0.3% (worse)
Linux ResetHeap1024/LLGo 146.600 ns/op -3.5 ns/op / -2.3% (better)
macOS AfterFuncZeroDelivery/Go 444.500 ns/op -77.8 ns/op / -14.9% (better)
macOS AfterFuncZeroDelivery/LLGo 65492 ns/op -19301 ns/op / -22.8% (better)
macOS CreateStop/Go 135 ns/op -54.8 ns/op / -28.9% (better)
macOS CreateStop/LLGo 436.600 ns/op -437.2 ns/op / -50.0% (better)
macOS RearmStopped/Go 58.200 ns/op -11.82 ns/op / -16.9% (better)
macOS RearmStopped/LLGo 361 ns/op -302 ns/op / -45.6% (better)
macOS ResetActive/Go 43.040 ns/op -8.39 ns/op / -16.3% (better)
macOS ResetActive/LLGo 173.800 ns/op -49.9 ns/op / -22.3% (better)
macOS ResetHeap1024/Go 47.190 ns/op -7.48 ns/op / -13.7% (better)
macOS ResetHeap1024/LLGo 95.990 ns/op -21.31 ns/op / -18.2% (better)
Windows MinGW AfterFuncZeroDelivery/Go 554.800 ns/op +6.4 ns/op / +1.2% (worse)
Windows MinGW AfterFuncZeroDelivery/LLGo 161022 ns/op -177 ns/op / -0.1% (better)
Windows MinGW CreateStop/Go 114.700 ns/op -4 ns/op / -3.4% (better)
Windows MinGW CreateStop/LLGo 455.800 ns/op +12.2 ns/op / +2.8% (worse)
Windows MinGW RearmStopped/Go 31.410 ns/op -0.31 ns/op / -1.0% (better)
Windows MinGW RearmStopped/LLGo 295.500 ns/op -5.8 ns/op / -1.9% (better)
Windows MinGW ResetActive/Go 20.060 ns/op -0.03 ns/op / -0.1% (better)
Windows MinGW ResetActive/LLGo 159.300 ns/op +0.5 ns/op / +0.3% (worse)
Windows MinGW ResetHeap1024/Go 20.390 ns/op -0.06 ns/op / -0.3% (better)
Windows MinGW ResetHeap1024/LLGo 140.200 ns/op -1.1 ns/op / -0.8% (better)
Windows MinGW 386 AfterFuncZeroDelivery/Go 581.100 ns/op +0.7 ns/op / +0.1% (worse)
Windows MinGW 386 AfterFuncZeroDelivery/LLGo 91141 ns/op -1958 ns/op / -2.1% (better)
Windows MinGW 386 CreateStop/Go 152.900 ns/op -0.3 ns/op / -0.2% (better)
Windows MinGW 386 CreateStop/LLGo 1492 ns/op +76 ns/op / +5.4% (worse)
Windows MinGW 386 RearmStopped/Go 58.470 ns/op 0 ns/op / +0.0%
Windows MinGW 386 RearmStopped/LLGo 245.400 ns/op +16.1 ns/op / +7.0% (worse)
Windows MinGW 386 ResetActive/Go 27.890 ns/op -0.02 ns/op / -0.1% (better)
Windows MinGW 386 ResetActive/LLGo 678.100 ns/op -57 ns/op / -7.8% (better)
Windows MinGW 386 ResetHeap1024/Go 27.870 ns/op 0 ns/op / +0.0%
Windows MinGW 386 ResetHeap1024/LLGo 118 ns/op +2.1 ns/op / +1.8% (worse)
Windows MinGW ARM64 AfterFuncZeroDelivery/Go 661.300 ns/op -14.6 ns/op / -2.2% (better)
Windows MinGW ARM64 AfterFuncZeroDelivery/LLGo 126305 ns/op -13364 ns/op / -9.6% (better)
Windows MinGW ARM64 CreateStop/Go 205 ns/op +5.3 ns/op / +2.7% (worse)
Windows MinGW ARM64 CreateStop/LLGo 406.500 ns/op -3.8 ns/op / -0.9% (better)
Windows MinGW ARM64 RearmStopped/Go 70.560 ns/op +0.17 ns/op / +0.2% (worse)
Windows MinGW ARM64 RearmStopped/LLGo 288.100 ns/op -2 ns/op / -0.7% (better)
Windows MinGW ARM64 ResetActive/Go 31.130 ns/op +0.17 ns/op / +0.5% (worse)
Windows MinGW ARM64 ResetActive/LLGo 121.100 ns/op +0.4 ns/op / +0.3% (worse)
Windows MinGW ARM64 ResetHeap1024/Go 31.150 ns/op +0.08 ns/op / +0.3% (worse)
Windows MinGW ARM64 ResetHeap1024/LLGo 143.300 ns/op -0.3 ns/op / -0.2% (better)
Windows MSVC AfterFuncZeroDelivery/Go 488.400 ns/op +6.3 ns/op / +1.3% (worse)
Windows MSVC AfterFuncZeroDelivery/LLGo 124742 ns/op -3927 ns/op / -3.1% (better)
Windows MSVC CreateStop/Go 116.300 ns/op +0.1 ns/op / +0.1% (worse)
Windows MSVC CreateStop/LLGo 462.800 ns/op -54.1 ns/op / -10.5% (better)
Windows MSVC RearmStopped/Go 31.560 ns/op -0.05 ns/op / -0.2% (better)
Windows MSVC RearmStopped/LLGo 301.100 ns/op +1.6 ns/op / +0.5% (worse)
Windows MSVC ResetActive/Go 19.070 ns/op -0.13 ns/op / -0.7% (better)
Windows MSVC ResetActive/LLGo 150.800 ns/op -30.4 ns/op / -16.8% (better)
Windows MSVC ResetHeap1024/Go 19.140 ns/op +0.05 ns/op / +0.3% (worse)
Windows MSVC ResetHeap1024/LLGo 150.200 ns/op +0.5 ns/op / +0.3% (worse)
Windows MSVC 386 AfterFuncZeroDelivery/Go 947.100 ns/op +16.6 ns/op / +1.8% (worse)
Windows MSVC 386 AfterFuncZeroDelivery/LLGo 189893 ns/op +5415 ns/op / +2.9% (worse)
Windows MSVC 386 CreateStop/Go 194.600 ns/op +1.1 ns/op / +0.6% (worse)
Windows MSVC 386 CreateStop/LLGo 1915 ns/op +10 ns/op / +0.5% (worse)
Windows MSVC 386 RearmStopped/Go 63.590 ns/op +0.38 ns/op / +0.6% (worse)
Windows MSVC 386 RearmStopped/LLGo 334.400 ns/op +1.9 ns/op / +0.6% (worse)
Windows MSVC 386 ResetActive/Go 38.960 ns/op -0.08 ns/op / -0.2% (better)
Windows MSVC 386 ResetActive/LLGo 928.800 ns/op -61.9 ns/op / -6.2% (better)
Windows MSVC 386 ResetHeap1024/Go 39.290 ns/op -0.14 ns/op / -0.4% (better)
Windows MSVC 386 ResetHeap1024/LLGo 175.400 ns/op -0.9 ns/op / -0.5% (better)
Windows MSVC ARM64 AfterFuncZeroDelivery/Go 671.300 ns/op +15.3 ns/op / +2.3% (worse)
Windows MSVC ARM64 AfterFuncZeroDelivery/LLGo 150983 ns/op +2664 ns/op / +1.8% (worse)
Windows MSVC ARM64 CreateStop/Go 197.400 ns/op +0.4 ns/op / +0.2% (worse)
Windows MSVC ARM64 CreateStop/LLGo 440.500 ns/op +7.2 ns/op / +1.7% (worse)
Windows MSVC ARM64 RearmStopped/Go 70.350 ns/op -0.24 ns/op / -0.3% (better)
Windows MSVC ARM64 RearmStopped/LLGo 308.700 ns/op +2.6 ns/op / +0.8% (worse)
Windows MSVC ARM64 ResetActive/Go 31.100 ns/op +0.01 ns/op / +0.03216% (worse)
Windows MSVC ARM64 ResetActive/LLGo 130.300 ns/op -3.9 ns/op / -2.9% (better)
Windows MSVC ARM64 ResetHeap1024/Go 31.080 ns/op -0.12 ns/op / -0.4% (better)
Windows MSVC ARM64 ResetHeap1024/LLGo 146.200 ns/op -0.5 ns/op / -0.3% (better)

Compared with b200f0f8eff6 measured in the same runner job.

@zhouguangyuan0718
zhouguangyuan0718 force-pushed the codex/llvm21-upgrade branch 2 times, most recently from 4b6e55f to bf6d6ef Compare August 15, 2026 08:42
@zhouguangyuan0718 zhouguangyuan0718 changed the title build: prepare the LLVM 21 upgrade build: upgrade LLGo to LLVM 21 Aug 27, 2026
@zhouguangyuan0718
zhouguangyuan0718 force-pushed the codex/llvm21-upgrade branch 4 times, most recently from 0e3c4ae to 3ec7475 Compare August 28, 2026 09:47
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.

1 participant