Skip to content

llvm: preserve GoObj marker relocs through inlining - #81

Merged
zhouguangyuan0718 merged 1 commit into
go1.27.masterfrom
codex/llvm-preserve-go-inline-boundaries
Aug 5, 2026
Merged

llvm: preserve GoObj marker relocs through inlining#81
zhouguangyuan0718 merged 1 commit into
go1.27.masterfrom
codex/llvm-preserve-go-inline-boundaries

Conversation

@zhouguangyuan0718

Copy link
Copy Markdown

Summary

  • encode function-owned GoObj marker relocations as metadata on llvm.sideeffect calls before LLVM optimization
  • materialize goobj.marker_relocs from each marker's final containing function in the statepoint plugin, then remove the intrinsic
  • allow fully inlined source functions to be deleted while retaining marker targets through llvm.compiler.used
  • update frontend checks and add an O2 regression that verifies relocation transfer from a deleted callee to its caller

This fixes the O2 runtime failures in fixedbugs/issue73888.go and fixedbugs/issue73888b.go without disabling LLVM inlining.

Stacked on #80; it should be retargeted to go1.27.master after #80 merges.

Testing

  • ctest --test-dir src/cmd/llvmplugin/cmake-build-debug --output-on-failure (58/58)
  • ./bin/go test -tags=llvm23,dynamicllvm cmd/compile/internal/ssa -count=1
  • full LLVM codegen whitelist
  • O2 runtime: fixedbugs/issue73888.go, fixedbugs/issue73888b.go

@zhouguangyuan0718
zhouguangyuan0718 changed the base branch from codex/llvm-statepoint-duplicate-phi-edge to go1.27.master August 5, 2026 08:23
@zhouguangyuan0718
zhouguangyuan0718 merged commit ecd9f89 into go1.27.master Aug 5, 2026
zhouguangyuan0718 added a commit that referenced this pull request Aug 15, 2026
This is the entry-argument-map and stack-growth layer of the remaining
runtime LLVM support. PR #133 is merged.


Stack: #136 (merged) -> #131 (merged) -> #132 (merged) -> #133 (merged)
-> this PR -> #135.

Implement the final entry-map and stack-growth contract agreed with LLVM
#78:

- every GoObj Go function keeps entry ArgsPointerMaps map 0
- entry and entry-depth PCDATA_StackMapIndex ranges use the native -1
sentinel
- runtime stack-map lookup interprets that sentinel as entry map 0
- nosplit and systemstack are explicit function policies; the obsolete
stack-growth statepoint attribute is removed
- morestack remains a raw call, while LLVM decides from final frame size
and leafness whether a split prologue is needed
- GoObj derives entry map ranges from CFG state rather than a dedicated
morestack marker

The Machine StackMaps bridge remains Go-owned: `GoALLCStackMapPrinter`
distinguishes the function-entry `STACKMAP` from ordinary statepoint
records and passes their raw locations through `MCContext`; LLVM only
provides generic metadata-printer dispatch and final GoObj
serialization. Object-level `objview` checks cover entry PCDATA=-1,
entry ArgsPointerMaps map 0, ordinary statepoint map 1, returning to
entry depth, and the morestack map-0 path.

The pinned payload is `goallc-llvm23.1.0-20260815T055258Z`, revision
`ce1ede9c622755eeeb0ea695d5bffad3bac32dcc`, released after LLVM #81
merged.

Validation after rebasing onto #133 merge `24581b9a69`:

- coordinated Release+assertions X86/AArch64 LLVM build
- 42 focused LLVM GoObj CodeGen tests
- 91/91 plugin CTest with structured objview checks
- prior joint `make.bash` and linux amd64/arm64 CI on the fallback
payload
- full `cmd/compile/internal/ssa` tests with LLVM enabled
- ABI differential source and machine ArgsPointerMaps tests
- caller-state and nosplit GoObj tests
- statepoint codegen through LLVM O2

The stale LLVM `nowritebarrierrec` propagation test from the old stack
was removed: finalized-IR enforcement remains the existing explicit TODO
and is outside this entry-map PR.

Supersedes the entry-argmap and stack-growth portion of #128.
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