Skip to content

test: guard static pointer conversions in full-LTO release builds - #3064

Open
cpunion wants to merge 2 commits into
xgo-dev:mainfrom
cpunion:fix/3020-static-itab-regression-20261112
Open

cpunion wants to merge 2 commits into
xgo-dev:mainfrom
cpunion:fix/3020-static-itab-regression-20261112

Conversation

@cpunion

@cpunion cpunion commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Protect the existing #2704 fix for #3020 in the ordinary -O3 -lto=full release profile:

//go:noinline
func convert(p *item) reader { return p }
// Load a static itab; no NewItab lookup or interface box.

Build the shared test/go case with full LTO, check frontend conversion IR before optimization, and execute checksum, identity and typed-nil assertions. Add conversion and preconstructed-interface benchmarks. The IR assertion guards frontend lowering; executing the final binary checks full-LTO semantics. No compiler/runtime implementation change is needed on current main.

Validation: the new regression fails on reported commit 3571c25 with a NewItab call and passes on main 96331c1. Regular and dev-tag host tests, standard Go, native LLGo and WASI checks pass; the dev-tag test explicitly uses ordinary release settings.

Fixes #3020.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

This PR only adds tests. The runtime fixture in test/go/static_itab_test.go looks correct. Both checksums are right: 45000 in the test, and the closed form in checkStaticItabBenchmark. The typed-nil case is a good addition.

The main problem is in internal/build/static_itab_test.go. The IR assertions run on the per-package IR before O3 or LTO runs, so only the runBinary step actually covers the full-LTO build. I also left a few smaller notes inline.

Comment thread internal/build/static_itab_test.go Resolved
Comment thread internal/build/static_itab_test.go Resolved
Comment thread internal/build/static_itab_test.go Resolved
Comment thread internal/build/static_itab_test.go Resolved
@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

perf: repeated static pointer-to-interface conversions call NewItab in full-LTO release profile

1 participant