Skip to content

AArch64: lower Go write barrier intrinsics - #17

Merged
zhouguangyuan0718 merged 2 commits into
goallc:llvm23.1.masterfrom
zhouguangyuan0718:codex/go-wb-unsafe-shrinkwrap
Aug 1, 2026
Merged

AArch64: lower Go write barrier intrinsics#17
zhouguangyuan0718 merged 2 commits into
goallc:llvm23.1.masterfrom
zhouguangyuan0718:codex/go-wb-unsafe-shrinkwrap

Conversation

@zhouguangyuan0718

@zhouguangyuan0718 zhouguangyuan0718 commented Aug 1, 2026

Copy link
Copy Markdown

Summary

  • define the Go write-barrier intrinsic contract
  • model the private ABI result directly in fixed register X25
  • lower it to an AArch64 call-like pseudo with the required private register clobbers
  • expand the pseudo without exposing a normal call to generic optimization or register allocation
  • avoid a result-register copy when the consumer can use X25 directly

Rebase and split

Rebased onto llvm23.1.master after #18 merged. The prior broad branch was split so this PR now contains only the AArch64 write-barrier intrinsic and lowering.

Moved to independent PRs:

Go PR goallc/go#32 consumes this PR together with #19. The merged alloca memory-root model from #18 is unchanged.

Validation

  • fresh llc and opt rebuild against the merged GoObj: describe fixed alloca roots in statepoint deopts #18 baseline
  • focused LLVM lit go-gc-write-barrier.ll: 1/1, covering default and O0 register allocation
  • post-RA MIR: GO_GC_WRITE_BARRIER directly defines X25
  • direct buffer use: bl runtime.gcWriteBarrier1 is immediately followed by str x0, [x25], with no result copy
  • ABI return use retains the required mov x0, x25
  • opt default, rewrite-statepoints-for-gc, llc -verify-machineinstrs, and GoObj generation
  • diff-only clang-format and git diff --check

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Hello @zhouguangyuan0718 👋

Thank you for submitting a Pull Request (PR) to the LLVM Project. Since this is your first PR, here are a few useful links covering our main contribution policies and review practices.

  • All contributions to LLVM must follow our LLVM AI Tool Use Policy. In particular, if you used AI while working on this PR, remember to add a note to the PR description.
  • The LLVM Code-Review Policy and Practices document contains practical information about the PR process, including how patches are reviewed and accepted, and who can review a PR.
  • Our LLVM Developer Policy describes our expectations for code quality, commit summaries and contains notes on our CI system.

Please reply to this message to confirm that you have read these policies, especially the LLVM AI Tool Use Policy, and that any AI tool usage has been noted in the PR description.


Frequently asked questions

How do I add reviewers?

This PR will be automatically labeled, and the relevant teams will be notified. For some parts of the project, reviewers may also be added automatically.

You can also add reviewers manually using the Reviewers section on this page. If you cannot use that section, it is probably because you do not have write permissions for the repository. In that case, you can request a review by tagging reviewers in a comment using @ followed by their GitHub username.

What if there are no comments?

If you have not received any comments on your PR after a week, you can request a review by pinging the PR with a comment such as “Ping”. The common courtesy ping rate is once a week. Please remember that you are asking for volunteer time from other developers.

Are any special GitHub settings required to contribute to LLVM?

We only require contributors to have a public email address associated with their GitHub commits, see this section of LLVM Developer Policy for details.


If you have questions, feel free to leave a comment on this PR, or ask on LLVM Discord or LLVM Discourse.

Thank you,
The LLVM Community

@zhouguangyuan0718
zhouguangyuan0718 force-pushed the codex/go-wb-unsafe-shrinkwrap branch from 068d8b5 to 4758d9a Compare August 1, 2026 04:53
@zhouguangyuan0718
zhouguangyuan0718 merged commit b681f44 into goallc:llvm23.1.master Aug 1, 2026
6 checks passed
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