[all-commits] [llvm/llvm-project] fcf0f8: [Clang][AMDGPU] Enable `avail-extern-to-local` for...

Shilei Tian via All-commits all-commits at lists.llvm.org
Mon Apr 14 08:52:40 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fcf0f810ac4b22bda3f21048784ee114da1cb061
      https://github.com/llvm/llvm-project/commit/fcf0f810ac4b22bda3f21048784ee114da1cb061
  Author: Shilei Tian <i at tianshilei.me>
  Date:   2025-04-14 (Mon, 14 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 (#134476)

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