Skip to content

Conversation

@madhur13490
Copy link
Contributor

The test clang/test/Driver/gpu-libc.c is run unconditionally. This should be run only if LLVM is built with X86, AMDGPU and NVPTX target, thus use *-registered-target.

The test clang/test/Driver/gpu-libc.c is run unconditionally. This should be run only if LLVM is built with X86, AMDGPU and NVPTX target. thus use *-registered-target.
@madhur13490 madhur13490 requested a review from jhuber6 November 7, 2025 06:35
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Nov 7, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 7, 2025

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Madhur Amilkanthwar (madhur13490)

Changes

The test clang/test/Driver/gpu-libc.c is run unconditionally. This should be run only if LLVM is built with X86, AMDGPU and NVPTX target, thus use *-registered-target.


Full diff: https://github.com/llvm/llvm-project/pull/166900.diff

1 Files Affected:

  • (modified) clang/test/Driver/gpu-libc.c (+2)
diff --git a/clang/test/Driver/gpu-libc.c b/clang/test/Driver/gpu-libc.c index 88f346f32e0b8..a2cf3907adb11 100644 --- a/clang/test/Driver/gpu-libc.c +++ b/clang/test/Driver/gpu-libc.c @@ -1,3 +1,5 @@ +// REQUIRES: x86-registered-target, amdgpu-registered-target, nvptx-registered-target + // RUN: %clang -### --target=amdgcn-amd-amdhsa -mcpu=gfx90a --sysroot=%S/Inputs/basic_gpu_tree \ // RUN: -ccc-install-dir %S/Inputs/basic_gpu_tree/bin -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-HEADERS-AMDGPU // RUN: %clang -### --target=nvptx64-nvidia-cuda -march=sm_89 --sysroot=%S/Inputs/basic_gpu_tree \ 
Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests don't depend on the respective backends as far as I'm aware so why is this necessary?

@madhur13490
Copy link
Contributor Author

The tests don't depend on the respective backends as far as I'm aware so why is this necessary?

My understanding is that when you compile a test for a target for which LLVM is not enabled (through LLVM_TARGETS_TO_BUILD), the test would fail.

for example,

clang++ --target=x86_64-unknown-linux-gnu a.cpp error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"' 1 error generated. 

Here, clang was built with LLVM_TARGETS_TO_BUILD="AArch64". Adding the REQUIRES line would skip the test.
Is my understanding correct?

@jhuber6
Copy link
Contributor

jhuber6 commented Nov 7, 2025

Is this something you observed with these tests? They all have -### on them so they don't even invoke -cc1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category

3 participants