[all-commits] [llvm/llvm-project] 142379: [Clang][AMDGPU] Enable `avail-extern-to-local` for...
Shilei Tian via All-commits
all-commits at lists.llvm.org
Fri Apr 4 19:58:58 PDT 2025
Branch: refs/heads/users/shiltian/hip-thinlto-disable-elim-avail-extern
Home: https://github.com/llvm/llvm-project
Commit: 14237920a276bdea7d5654bad738a5109b7629fc
https://github.com/llvm/llvm-project/commit/14237920a276bdea7d5654bad738a5109b7629fc
Author: Shilei Tian <i at tianshilei.me>
Date: 2025-04-04 (Fri, 04 Apr 2025)
Changed paths:
M clang/lib/Driver/ToolChains/HIPAMD.cpp
A clang/test/Driver/hip-thinlto.hip
Log Message:
-----------
[Clang][AMDGPU] Enable `avail-extern-to-local` for ThinLTO in HIP
In HIP, the Clang driver already sets `force-import-all` when ThinLTO is
enabled. As a result, all imported functions get the `available_externally`
linkage. However, these functions are later removed by the
`EliminateAvailableExternallyPass`, effectively undoing the forced import and
eventually leading to link errors.
The `EliminateAvailableExternallyPass` provides an option to convert
`available_externally` functions into local functions, renaming them to avoid
conflicts. This behavior is exactly what we need for HIP. This PR enables that
option (`avail-extern-to-local`) alongside `force-import-all` when ThinLTO is
used.
With this change, ThinLTO almost works correctly on AMDGPU. The only remaining
issue is an undefined reference to `__assert_fail`, but that falls outside the
scope of this PR.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list