Skip to content

LateLowerGCFrame: honor the "julia.safepoint" call-site marker - #63462

Merged
vchuravy merged 1 commit into
masterfrom
vc/effects-1-safepoint-marker
Oct 5, 2026
Merged

vchuravy merged 1 commit into
masterfrom
vc/effects-1-safepoint-marker

Conversation

@vchuravy

@vchuravy vchuravy commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

First of a 4-PR stack re-landing #61394 (reverted in #62697 because of #62613): #63462 → #63463 → #63464 → #63465.

Calls tagged with the string attribute "julia.safepoint" are Julia calls whose memory effects codegen narrowed from inferred effects (that emission lands in #63464). They can still reach a GC safepoint, so:

  • LocalScan treats tagged calls as safepoints regardless of what their memory effects claim, so rooting never depends on pass ordering having stripped the attributes first (the failure mode identified in add_fn_attrs_for_effects marks calls that can write memory as memory(read: argmem) #62613).
  • runOnFunction strips the memory effects (and any readnone on the gcstack argument) from tagged calls before any post-lowering pass could use them against the now-explicit GC frame stores.

On master nothing emits the marker yet, so this is a pure hardening change with no behavioral effect; it exists so the safety net is in place before #63464 relies on it. Subsumes the LocalScan gate from #62698.

Tests: five new cases in test/llvmpasses/late-lower-gc.ll (argmem-only, readonly, indirect call, gcstack readnone stripping, and a negative control for a genuinely readonly helper).

🤖 Generated with Claude Code

@vchuravy
vchuravy added this pull request to stack #63466 September 28, 2026 17:00
@vchuravy vchuravy changed the title vc/effects 1 safepoint marker LateLowerGCFrame: honor the "julia.safepoint" call-site marker Sep 28, 2026
@vchuravy vchuravy added compiler:codegen Generation of LLVM IR and native code GC Garbage collector labels Sep 28, 2026
@vchuravy
vchuravy marked this pull request as ready for review October 3, 2026 02:20
@vchuravy

vchuravy commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

This would also be useful for Enzyme, since it annotates calls more aggressively than Julia base.

Calls tagged "julia.safepoint" are Julia calls whose memory effects
codegen narrowed from inferred effects. They can still reach a GC
safepoint, so LocalScan must treat them as safepoints regardless of
what the memory effects claim, and the effects must be stripped before
any post-lowering pass could use them against the now-explicit GC frame
stores.

This is the rooting half of re-landing #61394 (reverted in #62697,
see #62613): rooting no longer depends on pass ordering having stripped
the attributes first.

Assisted-by: Claude Code (Fable 5.1)
@vchuravy
vchuravy force-pushed the vc/effects-1-safepoint-marker branch from 625f768 to 60e081d Compare October 3, 2026 02:21
@vchuravy
vchuravy requested a review from gbaraldi October 3, 2026 02:22
@vchuravy
vchuravy merged commit b5ad535 into master Oct 5, 2026
11 checks passed
@vchuravy
vchuravy deleted the vc/effects-1-safepoint-marker branch October 5, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler:codegen Generation of LLVM IR and native code GC Garbage collector

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant