[Go] Model stack ABI values with preallocated and goret - #70
[Go] Model stack ABI values with preallocated and goret#70zhouguangyuan0718 wants to merge 6 commits into
Conversation
|
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.
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 questionsHow 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 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, |
63926ea to
b4c49ff
Compare
b4c49ff to
102aaa4
Compare
|
I have read the LLVM AI Tool Use Policy and related contribution policies. The PR description now explicitly discloses the AI assistance used for implementation, analysis, and testing. |
Summary
preallocated(T)parameter attribute and operand bundlegoret(T)parameter attribute plus ordinary"goretindex"="N"key/value metadata; register results remain compact LLVM returnspreallocatedinputs directly into Go's reserved outgoing call frame on AArch64 and X86, without per-call dynamic stack adjustment or an intermediate argument allocapreallocated,goret, their operand bundles, and pointer fields through statepoint rewriting, Go pointer-map construction, and GoObj emissionllvm.call.preallocated.setupnon-mergeable so optimization cannot combine tokens belonging to distinct Go call sitesREP_MOVScopies for multiple large stack resultsbyvalcarrier and exercise the reservedpreallocatedoutgoing home insteadGo permits multiple mixed register/stack results, so this deliberately does not use LLVM
sret. There is no function-levelgo_memory_resultslist: each memory result records its logical result index on its own carrier.The standard
preallocatedIR contract is retained, but Go lowering uses the ABI's already-reserved outgoing call frame. The old fixed-home copy-elision hook explicitly excludespreallocatedandgoretcarriers and remains only for direct register parameters.Validation
preallocatedoptimization tests: 53/53 PASSgoret/REP_MOVSstatepoint regression: 24/24 PASSllcwith SIGSEGV and passes with tworep;movsqresult copies after the fixreflect.Value.callIR now lowers successfully to a 1.6 MB objectsrc/make.bashagainst the exact dynamic development payload: PASScmd/compile/internal/ssawithllvm23,dynamicllvm: PASSdefault<O2>: PASScompress/flatecurrent-package tests with native dependencies atdefault<O2>: 3 consecutive PASSarchive/zip,compress/flate,compress/gzip, andcompress/zlibPASS with full LLVM dependency closuresAI assistance was used to implement, analyze, and test this change. The resulting code and validation evidence were reviewed by the contributor.