Fix WebAssemblySpillPointers: use call-result heuristic instead of hasGC() guard#7
Draft
Copilot wants to merge 3 commits intorelease/16.xfrom
Draft
Fix WebAssemblySpillPointers: use call-result heuristic instead of hasGC() guard#7Copilot wants to merge 3 commits intorelease/16.xfrom
Copilot wants to merge 3 commits intorelease/16.xfrom
Conversation
…ut GC strategy Co-authored-by: PLUTOFX <110596339+PLUTOFX@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix unexpected failure during ninja check-llvm
Guard WebAssemblySpillPointers pass with hasGC() check
Mar 2, 2026
…SpillPointers The previous hasGC() check was wrong because Boehm GC (conservative GC) does not use LLVM's GC strategy annotations. Functions using Boehm GC just call GC_malloc/GC_gcollect as regular C calls. Replace with a heuristic: only activate spilling when the function has at least one call that returns a potential pointer (indicating it may call allocation functions like GC_malloc). When such a call exists, spill ALL potential pointers (arguments, loads, derived values) across all calls. Functions with only void-returning calls (like userstack.ll's ext_func) are correctly skipped. Co-authored-by: PLUTOFX <110596339+PLUTOFX@users.noreply.github.com>
Copilot
AI
changed the title
Guard WebAssemblySpillPointers pass with hasGC() check
Fix WebAssemblySpillPointers: use call-result heuristic instead of hasGC() guard
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
WebAssemblySpillPointerspass runs unconditionally at O2+, adding spill stack slots that inflate frame sizes and breakuserstack.ll(e.g.non_mem_useexpects 48-byte frame). The previous fix usinghasGC()was incorrect — Boehm GC doesn't use LLVM GC strategy annotations, sohasGC()is always false and the pass would never activate for its intended use case.Changes
hasGC()guard — wrong abstraction for conservative GCHasCallResultPointerheuristic in Phase 1 — tracks whether any call in the function returns a potential pointer (i.e., the function calls allocation routines likeGC_malloc)ext_func) skip spilling entirelyWhen a pointer-returning call is present, ALL potential pointers (arguments, loads, derived values) are still spilled across all calls, preserving full conservative GC correctness.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.