Conversation
jakebailey
reviewed
Sep 28, 2026
| @@ -1,4 +1,4 @@ | |||
| //go:build !llvm22 && !llvm14 && !llvm15 && !llvm16 && !llvm17 && !llvm18 && !llvm19 | |||
| //go:build !llvm22 && !llvm23 && !llvm14 && !llvm15 && !llvm16 && !llvm17 && !llvm18 && !llvm19 | |||
Member
There was a problem hiding this comment.
Out of order here (why are some files one way, some the other)
Adds the llvm23 build-tag config files, mirroring the existing llvm22 ones. Requires go-llvm branch dgryski/add-llvm23, not yet merged, so go.mod still points at the current go-llvm commit. Verified against real LLVM 23.1.1: a native build and a wasi build both produce working binaries. LLVM 23 keeps the wasm32-unknown-wasi triple deprecation and the Xtensa feature renames from LLVM 22. LLVM 23 removed the Os/Oz pipeline levels from the new pass manager's textual syntax. transform/optimizer.go now runs O2 instead on LLVM 23+, relying on the optsize/minsize function attributes already set elsewhere to steer size-conscious passes. LLVM 23 requires the llvm.returnaddress intrinsic's mangled name to include its pointer type suffix. Patches the linkName for that //export pragma in compiler/symbol.go. LLVM 23 splits the branch instruction into separate opcodes and reorders a conditional branch's operands from (cond, else, then) to (cond, then, else). interp/compiler.go hardcoded the old order, which silently inverted every branch condition the compile-time interpreter evaluated, sending most packages into infinite recursion during interp. Fixed with a version-gated operand read. Also normalizes the LLVM 23 nosync attribute (newly inferred for llvm.memcpy/llvm.memmove) in the golden IR test comparators, and updates a hardcoded Oz pipeline string in transform/unwind_test.go. Known gaps: a few golden IR comparison tests in compiler_test.go show cosmetic diffs from LLVM 23 output formatting (float hex constants, a GEP canonicalization change, attribute group renumbering). These are printer text drift, not correctness bugs. The Xtensa feature rename shim is extended to LLVM 23 by assumption, not verified against a real Xtensa-enabled toolchain.
cgo/libclang_config_llvm23.go: also search Homebrew's unversioned llvm formula, same reasoning as the matching go-llvm change. builder/commands.go: same idea for locating clang/lld/wasm-ld/lldb at run time, plus a bug fix this exposed. LookupCommand only recognized a bare command missing from $PATH as a reason to try the next candidate. A missing absolute path surfaces a different error and was treated as fatal, aborting the search before it reached a working fallback.
dgryski
force-pushed
the
dgryski/add-llvm23
branch
from
September 28, 2026 23:35
92b7ee8 to
7186e2b
Compare
Member
Author
|
This passes my test corpus as well as the stdlib tests on darwin/arm64 and wasip1. |
Member
Author
|
Will need to merge tinygo-org/go-llvm#79 first for llvm23 support and then update go.mod. |
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.
Adds
llvm23build-tag config, mirroring the existingllvm22support.Requires tinygo-org/go-llvm#79, which is not yet merged/tagged, so
go.modis left pointing at the current go-llvm commit for now.
Verified against real LLVM 23.1.1 headers and libraries (via Homebrew): both
a native build and a wasi build produce working binaries that run correctly.
LLVM 23 keeps the
wasm32-unknown-wasitriple deprecation and the Xtensafeature renames introduced in LLVM 22 (confirmed for the triple; the Xtensa
renames are assumed unchanged, not yet verified against an Xtensa-enabled
LLVM 23 toolchain).
LLVM 23 removed the
Os/Ozpipeline levels from the new pass manager'stextual pipeline syntax (
"thinlto-pre-link<Os>"now aborts with a fatalLLVM error).
transform/optimizer.gonow runs theO2pipeline levelinstead on LLVM 23+, relying on the
optsize/minsizefunction attributesalready set elsewhere to keep steering size-conscious passes.
LLVM 23 requires the
llvm.returnaddressintrinsic's mangled name to includeits pointer type suffix (
llvm.returnaddress.p0). Patches thelinkNameforthat specific
//exportpragma incompiler/symbol.go.LLVM 23 splits the conditional/unconditional branch instruction into separate
opcodes and, more importantly, reorders a conditional branch's operands from
(cond, else, then)to(cond, then, else).interp/compiler.gohardcodedthe old order when building its own branch instruction, which silently
inverted every branch condition evaluated by the compile-time interpreter
under LLVM 23, sending essentially all packages into infinite recursion
during interp. Fixed with a version-gated operand read.
Also normalizes away the LLVM 23
nosyncattribute (newly inferred forllvm.memcpy/llvm.memmove) in the golden-IR test comparators incompiler_test.go,transform_test.goandinterp_test.go, and updates ahardcoded
"Oz"pipeline string intransform/unwind_test.gothe same wayas the production code path.
Known gaps
compiler_test.goshowcosmetic diffs from LLVM 23's own output-formatting changes (float
hex-constant syntax, a GEP-canonicalization preference change, and
attribute-group renumbering). These are optimizer/printer text drift, not
correctness bugs; fixing them properly needs per-LLVM-version golden
fixtures, which is out of scope here.
compileopts/features_llvm22.go)is extended to LLVM 23 by assumption, not verified against a real
Xtensa-enabled LLVM 23 toolchain.
🤖 Generated with Claude Code