[HIP] [AlwaysInliner] Disable AlwaysInliner to eliminate undefined symbols
authorAnshil Gandhi <Anshil.Gandhi@amd.com>
Mon, 18 Oct 2021 22:51:20 +0000 (16:51 -0600)
committerAnshil Gandhi <Anshil.Gandhi@amd.com>
Mon, 18 Oct 2021 22:53:15 +0000 (16:53 -0600)
commit0567f0333176e476e15b7f32b463f58f7475ff22
tree39f78ef1e3390f566caf715bf8d25d2e0b9c207d
parentb477b927749707982414d06674c7d2af276e046c
[HIP] [AlwaysInliner] Disable AlwaysInliner to eliminate undefined symbols

By default clang emits complete contructors as alias of base constructors if they are the same.
The backend is supposed to emit symbols for the alias, otherwise it causes undefined symbols.
@yaxunl observed that this issue is related to the llvm options `-amdgpu-early-inline-all=true`
and `-amdgpu-function-calls=false`. This issue is resolved by only inlining global values
with internal linkage. The `getCalleeFunction()` in AMDGPUResourceUsageAnalysis also had
to be extended to support aliases to functions. inline-calls.ll was corrected appropriately.

Reviewed By: yaxunl, #amdgpu

Differential Revision: https://reviews.llvm.org/D109707
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGenCUDA/amdgpu-alias-undef-symbols.cu [new file with mode: 0644]
llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp
llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
llvm/test/CodeGen/AMDGPU/inline-calls.ll