Skip to content

Commit 4b415b1

Browse files
authored
[Clang][AMDGPU] Search both amdgcn and amdgpu libraries (#209770)
Summary: Temporary workaround as we transition triples from amdgcn to amdgpu.
1 parent 6526c5b commit 4b415b1

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

clang/lib/Driver/ToolChain.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,14 @@ ToolChain::getTargetSubDirPath(StringRef BaseDir) const {
11221122
if (auto Path = getPathForTriple(T))
11231123
return *Path;
11241124

1125+
// Handle the legacy AMDGPU triple case as well.
1126+
if (T.getArchName() == "amdgcn") {
1127+
llvm::Triple Canon(T);
1128+
Canon.setArchName("amdgpu");
1129+
if (auto Path = getPathForTriple(Canon))
1130+
return *Path;
1131+
}
1132+
11251133
if (T.isOSAIX()) {
11261134
llvm::Triple AIXTriple;
11271135
if (T.getEnvironment() == Triple::UnknownEnvironment) {

clang/test/Driver/Inputs/resource_dir_with_amdgpu_per_target_subdir/lib/amdgpu-amd-amdhsa/libclang_rt.profile.a

Whitespace-only changes.

clang/test/Driver/amdgpu-toolchain.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,9 @@
7171
// RUN: | FileCheck -check-prefixes=UBSAN %s
7272
// UBSAN: ld.lld
7373
// UBSAN-SAME: "[[RESOURCE_DIR:.+]]{{/|\\\\}}lib{{/|\\\\}}amdgcn-amd-amdhsa{{/|\\\\}}libclang_rt.ubsan_minimal.a"
74+
75+
// RUN: %clang -### --target=amdgcn-amd-amdhsa -mcpu=gfx906 -nogpulib \
76+
// RUN: -resource-dir=%S/Inputs/resource_dir_with_amdgpu_per_target_subdir \
77+
// RUN: -fprofile-generate %s 2>&1 | FileCheck -check-prefixes=PROFILE-AMDGPU %s
78+
// PROFILE-AMDGPU: ld.lld
79+
// PROFILE-AMDGPU-SAME: "[[RESOURCE_DIR:.+]]{{/|\\\\}}lib{{/|\\\\}}amdgpu-amd-amdhsa{{/|\\\\}}libclang_rt.profile.a"

0 commit comments

Comments
 (0)