Repository navigation
Keep compiled entries pointing at the functions after sanitizing names - #1081
Open
oscardssmith wants to merge 1 commit into
Open
oscardssmith wants to merge 1 commit into
oscardssmith wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1081 +/- ##
===========================================
- Coverage 92.86% 76.48% -16.39%
===========================================
Files 31 31
Lines 7775 7564 -211
===========================================
- Hits 7220 5785 -1435
- Misses 555 1779 +1224 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
`irgen` sanitizes the names of defined functions after `compiled` has recorded them, so entries for functions like `julia_f+_0` named functions that no longer exist. Record the names actually given and update the entries. Sanitized names can also collide, e.g. `julia_+_0` and `julia_-_0` from Julia 1.14, which numbers functions per compilation. LLVM would then uniquify the second name with a `.` suffix, which is not a safe name, so pick a free `_N` suffix instead. That keeps consumers that sanitize `compiled` names themselves, like Enzyme, finding the right function. Co-authored-by: Tim Besard <tim.besard@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
maleadt
force-pushed
the
os/sanitize-name-collisions
branch
from
November 6, 2026 13:08
8162938 to
4e4bcdc
Compare
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.
irgensanitizes the names of defined functions (julia_f+_0becomesjulia_f__0) aftercompile_method_instancehas recorded them incompiled. The entries for those functions then named functions that no longer exist in the module, on every Julia version.From Julia 1.14, which numbers functions per compilation, sanitized names also collide:
julia_+_0andjulia_-_0both becomejulia___0. LLVM uniquifies the second one asjulia___0.1, which is not a safe name. Consumers that sanitizecompilednames themselves, like Enzyme'sprepare_llvm, then look upjulia___0_1and miss the function. Onmain, both entries resolve to the same function instead.This PR picks a free
_Nsuffix when a sanitized name is taken, and updatescompiledwith the names actually given. The new test compiles two callees whose names collide after sanitizing. It checks that every name incompiledexists in the module, is safe and distinct, and refers to the right function. It fails onmainon 1.13 and 1.14.