Skip to content

cmd: unblock LLVM bit operations and stack layouts - #75

Merged
zhouguangyuan0718 merged 3 commits into
go1.27.masterfrom
codex/llvm-ctz-lowering
Aug 5, 2026
Merged

cmd: unblock LLVM bit operations and stack layouts#75
zhouguangyuan0718 merged 3 commits into
go1.27.masterfrom
codex/llvm-ctz-lowering

Conversation

@zhouguangyuan0718

@zhouguangyuan0718 zhouguangyuan0718 commented Aug 4, 2026

Copy link
Copy Markdown

Follow-up to the merged #74. This PR now intentionally excludes the proposed StackObject live-root materialization; that design and all dependent whitelist claims have been removed.

Changes:

  • lower Ctz8/16/32/64, including NonZero, through llvm.cttz
  • lower PopCount8/16/32/64 through llvm.ctpop
  • treat zero-length arrays of pointer-containing elements as pointer-free layouts
  • qualify seven Darwin/arm64 runtime cases that pass independently of any StackObject change

Explicitly not included:

  • no .gcroot materialization for live StackObject addresses
  • no changes to alloca-statepoint GoObj expectations
  • fixedbugs/issue27518b.go remains outside the whitelist
  • llvm_alloca_statepoint_gc.go remains outside the whitelist

Validation:

  • cmd/compile/internal/ssa: pass with llvm23,dynamicllvm
  • GoALLC plugin CTest: 57/57
  • codegen/mathbits.go: pass
  • alloca-statepoint retains the existing contract: FuncInfo.locals=88, LocalsPointerMaps=[[]], stack-map queries=[0 0 0 0 0]
  • cmp.go, convert4.go, ddd.go, issue16095.go, issue32288.go, nilptr2.go, and typeparam/list2.go: 3/3 each without the removed StackObject implementation

Current Darwin/arm64 whitelist size: 72 codegen, 1075 runtime.

@zhouguangyuan0718

Copy link
Copy Markdown
Author

Final qualification after rebasing on the refreshed #74:

  • full Test/LLVM: 72/72 codegen, 1077/1077 runtime, 1842.223s
  • plugin CTest after an explicit ccache-backed rebuild: 57/57
  • alloca-statepoint GoObj: FuncInfo.locals=104, LocalsPointerMaps=[[] [11]], stack-map queries=[1 1 1 1 0]
  • issue27518b.go: 3/3 after the final rebuild
  • stackobj.go, stackobj2.go, stackobj3.go: pass

The runtime.newproc caller fake-use experiment was deliberately dropped: llvm_newproc_gc.go still failed 5/5 with captured payload 0, so the remaining defect is in publication/new-goroutine funcval context rather than only caller safepoint liveness.

@zhouguangyuan0718
zhouguangyuan0718 force-pushed the codex/llvm-ctz-lowering branch from 03adba1 to 251aacf Compare August 5, 2026 01:34
@zhouguangyuan0718
zhouguangyuan0718 changed the base branch from codex/defer-callbr to go1.27.master August 5, 2026 01:34
@zhouguangyuan0718

Copy link
Copy Markdown
Author

StackObject correction applied: the scoped .gcroot implementation, modified alloca/GoObj expectations, issue27518b whitelist entry, and llvm_alloca_statepoint_gc whitelist entry have all been removed. The branch was rebuilt directly on merged go1.27.master. Seven remaining runtime additions were rerun 3x each without any StackObject change and passed; plugin CTest is 57/57 and the existing alloca-statepoint contract remains locals=88 / LocalsPointerMaps=[[]].

@zhouguangyuan0718
zhouguangyuan0718 merged commit 5d76dd0 into go1.27.master Aug 5, 2026
@zhouguangyuan0718
zhouguangyuan0718 deleted the codex/llvm-ctz-lowering branch August 5, 2026 01:39
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