Skip to content

Rework intrinsics#85

Merged
maleadt merged 17 commits intomainfrom
tb/efuncs
Feb 11, 2026
Merged

Rework intrinsics#85
maleadt merged 17 commits intomainfrom
tb/efuncs

Conversation

@maleadt
Copy link
Member

@maleadt maleadt commented Feb 9, 2026

  • emitted as :call, not :invoke, allowing easier spoofing of effects
  • added efuncs to set proper effects
  • added and extended tfuncs to model const-prop behavior
  • removed bodies

Thanks to @vchuravy for the help.

That avoids CIs, allowing easier spoofing of effects through efuncs.
Copy link
Member

@vchuravy vchuravy left a comment

Choose a reason for hiding this comment

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

Neat!

@maleadt
Copy link
Member Author

maleadt commented Feb 10, 2026

Going to minimize some of the intrinsic definitions still, removing bodies where possible.

@vchuravy
Copy link
Member

Unsure if you need it, but if you add the lattice (the weird L) as an argument to your tfunc, you can also participate in the extended lattice and as an example implement the correct behavior when you get a PartialConst

@maleadt maleadt marked this pull request as draft February 10, 2026 20:27
@maleadt maleadt changed the title Emit our intrinsics as :calls instead of :invoke. Rework intrinsics Feb 11, 2026
maleadt and others added 9 commits February 11, 2026 09:09
When Julia's optimizer constant-folds an SSA statement (via concrete eval,
SROA, constant propagation), it becomes a bare literal value instead of an
Expr(:call, ...). The else-branch in emit_statement! previously just warned
and discarded these, so the SSA slot was never registered in ctx.values,
causing "SSAValue not found" crashes for any downstream reference.

Delegate to emit_constant!/emit_value! for literal values, mirroring the
existing pattern in emit_rhs!. Add regression test using crafted IR (the
optimizer propagates constants too aggressively for a source-level repro).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously, emit_expr! returned nothing for Expr(:boundscheck), so the
SSA slot was never registered. When the IR structurizer created an IfOp
whose condition referenced that SSA, emit_value! crashed with "SSAValue
not found". This happens when concrete_eval_eligible doesn't block
semi-concrete eval, causing @BoundsCheck blocks from tuple indexing in
the One() adapter to survive to codegen.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maleadt maleadt marked this pull request as ready for review February 11, 2026 10:53
@maleadt maleadt merged commit 6642b4d into main Feb 11, 2026
8 checks passed
@maleadt maleadt deleted the tb/efuncs branch February 11, 2026 10:54
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.

2 participants