diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -4313,8 +4313,8 @@ /// incompatible pair if a conflict occurs. static std::optional> getConflictOffloadArchCombination(const llvm::DenseSet &Archs, - Action::OffloadKind Kind) { - if (Kind != Action::OFK_HIP) + llvm::Triple Triple) { + if (!Triple.isAMDGPU()) return std::nullopt; std::set ArchSet; @@ -4399,7 +4399,8 @@ } } - if (auto ConflictingArchs = getConflictOffloadArchCombination(Archs, Kind)) { + if (auto ConflictingArchs = getConflictOffloadArchCombination(Archs, + TC->getTriple())) { C.getDriver().Diag(clang::diag::err_drv_bad_offload_arch_combo) << ConflictingArchs->first << ConflictingArchs->second; C.setContainsError(); diff --git a/clang/test/Driver/amdgpu-openmp-toolchain.c b/clang/test/Driver/amdgpu-openmp-toolchain.c --- a/clang/test/Driver/amdgpu-openmp-toolchain.c +++ b/clang/test/Driver/amdgpu-openmp-toolchain.c @@ -66,3 +66,7 @@ // RUN: %clang -### -target x86_64-pc-linux-gnu -fopenmp --offload-arch=gfx90a:sramecc-:xnack+ \ // RUN: -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-TARGET-ID // CHECK-TARGET-ID: clang-offload-packager{{.*}}arch=gfx90a:sramecc-:xnack+,kind=openmp,feature=-sramecc,feature=+xnack + +// RUN: not %clang -### -target x86_64-pc-linux-gnu -fopenmp --offload-arch=gfx90a,gfx90a:xnack+ \ +// RUN: -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-TARGET-ID-ERROR +// CHECK-TARGET-ID-ERROR: error: invalid offload arch combinations: 'gfx90a' and 'gfx90a:xnack+'