[libspirv] Clone remangled functions on name clash (private default AS) - #20889
Merged
sarnex merged 4 commits intoDec 16, 2025
Merged
Conversation
When the target’s default address space is private (e.g., SPIR), pointer address space remangling and long -> long long remangling can cause clone name collisions, preventing the remangled function from being cloned. Example: _Z1fPm -> remangled to _Z1fPU3AS0y; remangler clones back to _Z1fPm to preserve the original. Later, _Z1fPU3AS4m -> remangled to _Z1fPy; we need to clone _Z1fPy to _Z1fPm, but _Z1fPm already exists. Fix: Append a temporary suffix to avoid clashes (e.g., _Z1fPm$TmpSuffix). Remove the suffix in post-processing, replacing the old _Z1fPm (clone of _Z1fPU3AS0y) with the new remangled implementation. llvm-diff shows no change for targets whose default AS isn't private: remangled-l64-signed_char.libspirv-nvptx64-nvidia-cuda.bc and remangled-l64-unsigned_char.libspirv-amdgcn-amd-amdhsa.bc.
wenju-he
had a problem deploying
to
WindowsCILock
December 15, 2025 02:00 — with
GitHub Actions
Error
wenju-he
temporarily deployed
to
WindowsCILock
December 15, 2025 02:37 — with
GitHub Actions
Inactive
wenju-he
temporarily deployed
to
WindowsCILock
December 15, 2025 03:08 — with
GitHub Actions
Inactive
wenju-he
temporarily deployed
to
WindowsCILock
December 15, 2025 03:08 — with
GitHub Actions
Inactive
wenju-he
temporarily deployed
to
WindowsCILock
December 15, 2025 03:08 — with
GitHub Actions
Inactive
wenju-he
temporarily deployed
to
WindowsCILock
December 15, 2025 04:06 — with
GitHub Actions
Inactive
wenju-he
temporarily deployed
to
WindowsCILock
December 15, 2025 04:30 — with
GitHub Actions
Inactive
wenju-he
temporarily deployed
to
WindowsCILock
December 15, 2025 04:30 — with
GitHub Actions
Inactive
wenju-he
temporarily deployed
to
WindowsCILock
December 15, 2025 04:30 — with
GitHub Actions
Inactive
bratpiorka
approved these changes
Dec 15, 2025
wenju-he
temporarily deployed
to
WindowsCILock
December 16, 2025 00:27 — with
GitHub Actions
Inactive
wenju-he
temporarily deployed
to
WindowsCILock
December 16, 2025 00:53 — with
GitHub Actions
Inactive
wenju-he
had a problem deploying
to
WindowsCILock
December 16, 2025 00:53 — with
GitHub Actions
Failure
wenju-he
temporarily deployed
to
WindowsCILock
December 16, 2025 00:53 — with
GitHub Actions
Inactive
wenju-he
had a problem deploying
to
WindowsCILock
December 16, 2025 01:27 — with
GitHub Actions
Failure
wenju-he
had a problem deploying
to
WindowsCILock
December 16, 2025 02:00 — with
GitHub Actions
Failure
Contributor
Author
|
@intel/llvm-gatekeepers please merge, thanks. |
wenju-he
temporarily deployed
to
WindowsCILock
December 16, 2025 20:35 — with
GitHub Actions
Inactive
Contributor
|
@intel/llvm-gatekeepers This is ready for merge, thanks. |
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.
When the target’s default address space is private (e.g., SPIR), simultaneous pointer address space remangling and long -> long long remangling can cause clone name collisions, preventing the remangled function from being cloned.
Example:
_Z1fPm -> remangled to _Z1fPU3AS0y; remangler clones back to _Z1fPm to preserve the original.
Later, _Z1fPU3AS4m -> remangled to _Z1fPy; we need to clone _Z1fPy to _Z1fPm, but _Z1fPm already exists.
Fix:
Append a temporary suffix to avoid clashes (e.g., _Z1fPm$TmpSuffix). Remove the suffix in post-processing, replacing the old _Z1fPm (clone of _Z1fPU3AS0y) with the new remangled implementation.
llvm-diff shows no change for targets whose default AS isn't private: remangled-l64-signed_char.libspirv-nvptx64-nvidia-cuda.bc and remangled-l64-unsigned_char.libspirv-amdgcn-amd-amdhsa.bc.