Skip to content

cmd/compile: add first-phase defer lowering for LLVM - #74

Merged
zhouguangyuan0718 merged 4 commits into
go1.27.masterfrom
codex/defer-callbr
Aug 5, 2026
Merged

cmd/compile: add first-phase defer lowering for LLVM#74
zhouguangyuan0718 merged 4 commits into
go1.27.masterfrom
codex/defer-callbr

Conversation

@zhouguangyuan0718

@zhouguangyuan0718 zhouguangyuan0718 commented Aug 4, 2026

Copy link
Copy Markdown

Implement first-phase classic defer support in the LLVM backend.

Summary:

  • lower SSA BlockDefer to llvm.go.defer.edge callbr recovery CFG;
  • preserve distinct deferproc, deferprocStack, and deferprocat pointer ABI shapes;
  • keep open-coded defers on the classic path for now;
  • propagate GoObj FuncID/FuncFlag so defer wrappers remain transparent to recover;
  • add codegen, runtime, plugin GoObj, and defer regression coverage;
  • qualify 113 newly passing runtime tests while keeping unrelated unstable GC cases out of this PR whitelist.

Whitelist on Darwin/arm64:

  • codegen: 71 files
  • runtime: 1068 files

The inherited llvm_alloca_statepoint_gc.go and llvm_newproc_gc.go cases are intentionally excluded here. The former is requalified by the scoped stack-object-root fix in #75; the latter remains a known runtime failure.

Dependencies:

Validated with upstream defer/recover/range tests and focused LLVM/GoObj checks.

@zhouguangyuan0718

Copy link
Copy Markdown
Author

LLVM blacklist probe (darwin/arm64)

Using the matching LLVM payload and GOALLC_FILECHECK, with a 40-minute suite timeout:

  • codegen: 55 blacklist candidates; 47 pass compile+verifier, 6 skipped by platform/experiment build tags, 2 fail (mathbits.go / unsupported Ctz64; writebarrier.go / wbMove pointer-shape check).
  • runtime: 166 candidates; 114 pass, 13 skipped by build tags, 38 fail; fixedbugs/issue29312.go was separately stopped after 10 minutes of continuous llc CPU and is recorded as one performance timeout.
  • effective pass total: 161 cases; skipped: 19; failed/timeout: 41.

I did not bulk-promote these cases into test/llvm_tests.json: codegen passes without FileCheck are compile/verifier-only, and runtime failures include independent GoObj pointer-map, pcsp, traceback/debug-line, and test-harness issues that need separate qualification.

@zhouguangyuan0718

Copy link
Copy Markdown
Author

Whitelist refresh is now scoped to this PR: 71 Darwin/arm64 codegen files and 1068 runtime files. The defer probe added 113 stable runtime cases. I removed llvm_alloca_statepoint_gc.go and llvm_newproc_gc.go from this layer because neither failure is fixed by defer lowering itself; #75 requalifies the alloca case after its scoped-root fix.

@zhouguangyuan0718
zhouguangyuan0718 merged commit 8b867fb into go1.27.master Aug 5, 2026
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