Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Driver] Remove a bunch of unnecessary REQUIRES constraints #94055

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

pogo59
Copy link
Collaborator

@pogo59 pogo59 commented May 31, 2024

Removed foo-registered-target constraints from a bunch of tests, because mostly the driver doesn't need to have a target availabile. I ran check-clang-driver using a build with only the XCore target, and these all passed.

There are ~50 tests that still have foo-registered-target, and it looks like most of them are either doing codegen when they don't need to, or don't really belong in the Driver tests. But that's a task for another day.

Removed foo-registered-target constraints from a bunch of tests,
because mostly the driver doesn't need to have a target availabile. I
ran check-clang-driver using a build with only the XCore target, and
these all passed.

There are ~50 tests that still have foo-registered-target, and it
looks like most of them are either doing codegen when they don't need
to, or don't really belong in the Driver tests. But that's a task for
another day.
@pogo59 pogo59 requested review from MaskRay, yxsamliu and jhuber6 May 31, 2024 22:05
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:AMDGPU backend:RISC-V clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels May 31, 2024
@llvmbot
Copy link
Member

llvmbot commented May 31, 2024

@llvm/pr-subscribers-backend-amdgpu
@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: Paul T Robinson (pogo59)

Changes

Removed foo-registered-target constraints from a bunch of tests, because mostly the driver doesn't need to have a target availabile. I ran check-clang-driver using a build with only the XCore target, and these all passed.

There are ~50 tests that still have foo-registered-target, and it looks like most of them are either doing codegen when they don't need to, or don't really belong in the Driver tests. But that's a task for another day.


Patch is 63.54 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/94055.diff

133 Files Affected:

  • (modified) clang/test/Driver/aarch64-outliner.c (-1)
  • (modified) clang/test/Driver/amdgcn-gz-options.cl (+1-1)
  • (modified) clang/test/Driver/amdgpu-hip-system-arch.c (-2)
  • (modified) clang/test/Driver/amdgpu-invalid-target-id.s (-3)
  • (modified) clang/test/Driver/amdgpu-macros.cl (-1)
  • (modified) clang/test/Driver/amdgpu-openmp-system-arch-fail.c (-2)
  • (modified) clang/test/Driver/amdgpu-openmp-toolchain.c (-2)
  • (modified) clang/test/Driver/arm-float-abi-runtime-path.c (-2)
  • (modified) clang/test/Driver/arm-float-abi.c (-1)
  • (modified) clang/test/Driver/arm-machine-outliner.c (-1)
  • (modified) clang/test/Driver/cl-options.cu (-3)
  • (modified) clang/test/Driver/clang-offload-bundler-zlib.c (-1)
  • (modified) clang/test/Driver/clang-offload-bundler-zstd.c (-1)
  • (modified) clang/test/Driver/compress-noias.c (-1)
  • (modified) clang/test/Driver/cuda-arch-translation.cu (-3)
  • (modified) clang/test/Driver/cuda-bad-arch.cu (-3)
  • (modified) clang/test/Driver/cuda-bail-out.cu (-3)
  • (modified) clang/test/Driver/cuda-bindings.cu (-3)
  • (modified) clang/test/Driver/cuda-constructor-alias.cu (-3)
  • (modified) clang/test/Driver/cuda-cross-compiling.c (-2)
  • (modified) clang/test/Driver/cuda-detect-path.cu (-2)
  • (modified) clang/test/Driver/cuda-detect.cu (-3)
  • (modified) clang/test/Driver/cuda-external-tools.cu (-3)
  • (modified) clang/test/Driver/cuda-macosx.cu (-3)
  • (modified) clang/test/Driver/cuda-march.cu (-3)
  • (modified) clang/test/Driver/cuda-omp-unsupported-debug-options.cu (-2)
  • (modified) clang/test/Driver/cuda-openmp-driver.cu (-3)
  • (modified) clang/test/Driver/cuda-options.cu (-2)
  • (modified) clang/test/Driver/cuda-output-asm.cu (-3)
  • (modified) clang/test/Driver/cuda-phases.cu (-3)
  • (modified) clang/test/Driver/cuda-ptxas-path.cu (-3)
  • (modified) clang/test/Driver/cuda-version-check.cu (-3)
  • (modified) clang/test/Driver/cuda-windows.cu (-3)
  • (modified) clang/test/Driver/driverkit-arm64.c (-1)
  • (modified) clang/test/Driver/driverkit-arm64e.c (-1)
  • (modified) clang/test/Driver/driverkit-cplusplus.cpp (-1)
  • (modified) clang/test/Driver/driverkit-exceptions.cpp (-1)
  • (modified) clang/test/Driver/driverkit-path.c (-1)
  • (modified) clang/test/Driver/driverkit-rtti.cpp (-1)
  • (modified) clang/test/Driver/driverkit-target-cpu.c (-1)
  • (modified) clang/test/Driver/dwarf-target-version-clamp.cu (-3)
  • (modified) clang/test/Driver/elfiamcu-header-search.c (-2)
  • (modified) clang/test/Driver/global-isel.c (-2)
  • (modified) clang/test/Driver/gpu-libc-headers.c (-3)
  • (modified) clang/test/Driver/hexagon-toolchain-elf.c (-1)
  • (modified) clang/test/Driver/hip-autolink.hip (-3)
  • (modified) clang/test/Driver/hip-binding.hip (-3)
  • (modified) clang/test/Driver/hip-code-object-version.hip (-3)
  • (modified) clang/test/Driver/hip-cuid-hash.hip (-3)
  • (modified) clang/test/Driver/hip-cuid.hip (-3)
  • (modified) clang/test/Driver/hip-default-gpu-arch.hip (-3)
  • (modified) clang/test/Driver/hip-device-compile.hip (-3)
  • (modified) clang/test/Driver/hip-device-libs.hip (-3)
  • (modified) clang/test/Driver/hip-fpie-option.hip (+1-1)
  • (modified) clang/test/Driver/hip-gsplit-dwarf-options.hip (+1-1)
  • (modified) clang/test/Driver/hip-gz-options.hip (+1-1)
  • (modified) clang/test/Driver/hip-host-cpu-features.hip (-3)
  • (modified) clang/test/Driver/hip-include-path.hip (-2)
  • (modified) clang/test/Driver/hip-inputs.hip (-3)
  • (modified) clang/test/Driver/hip-invalid-target-id.hip (-3)
  • (modified) clang/test/Driver/hip-launch-api.hip (-3)
  • (modified) clang/test/Driver/hip-link-bc-to-bc.hip (-2)
  • (modified) clang/test/Driver/hip-link-bundle-archive.hip (-2)
  • (modified) clang/test/Driver/hip-link-save-temps.hip (-3)
  • (modified) clang/test/Driver/hip-link-static-library.hip (-3)
  • (modified) clang/test/Driver/hip-no-device-libs.hip (-3)
  • (modified) clang/test/Driver/hip-offload-arch.hip (-2)
  • (modified) clang/test/Driver/hip-offload-compress-zlib.hip (-2)
  • (modified) clang/test/Driver/hip-offload-compress-zstd.hip (-2)
  • (modified) clang/test/Driver/hip-options.hip (+1-4)
  • (modified) clang/test/Driver/hip-output-file-name.hip (-3)
  • (modified) clang/test/Driver/hip-phases.hip (-3)
  • (modified) clang/test/Driver/hip-printf.hip (-3)
  • (modified) clang/test/Driver/hip-rdc-device-only.hip (-3)
  • (modified) clang/test/Driver/hip-sanitize-options.hip (-2)
  • (modified) clang/test/Driver/hip-save-temps.hip (-3)
  • (modified) clang/test/Driver/hip-std.hip (-3)
  • (modified) clang/test/Driver/hip-syntax-only.hip (-3)
  • (modified) clang/test/Driver/hip-target-id.hip (-3)
  • (modified) clang/test/Driver/hip-toolchain-device-only.hip (-2)
  • (modified) clang/test/Driver/hip-toolchain-dwarf.hip (-3)
  • (modified) clang/test/Driver/hip-toolchain-features.hip (-3)
  • (modified) clang/test/Driver/hip-toolchain-mllvm.hip (-3)
  • (modified) clang/test/Driver/hip-toolchain-no-rdc.hip (-3)
  • (modified) clang/test/Driver/hip-toolchain-opt.hip (-3)
  • (modified) clang/test/Driver/hip-toolchain-rdc-separate.hip (-3)
  • (modified) clang/test/Driver/hip-toolchain-rdc-static-lib.hip (-3)
  • (modified) clang/test/Driver/hip-toolchain-rdc.hip (-3)
  • (modified) clang/test/Driver/hip-unbundle-preproc.hipi (-2)
  • (modified) clang/test/Driver/hip-wavefront-size.hip (-2)
  • (modified) clang/test/Driver/hip-windows-filename.hip (+1-1)
  • (modified) clang/test/Driver/hipspv-device-libs.hip (-1)
  • (modified) clang/test/Driver/hipspv-pass-plugin.hip (-1)
  • (modified) clang/test/Driver/hipspv-toolchain-rdc.hip (-1)
  • (modified) clang/test/Driver/hipspv-toolchain.hip (-1)
  • (modified) clang/test/Driver/indirect-tls-seg-refs.c (-2)
  • (modified) clang/test/Driver/invalid-offload-options.cpp (-1)
  • (modified) clang/test/Driver/invalid-target-id.cl (-3)
  • (modified) clang/test/Driver/lto.cu (-3)
  • (modified) clang/test/Driver/m68k-features.cpp (-1)
  • (modified) clang/test/Driver/mbackchain.c (-1)
  • (modified) clang/test/Driver/mips-abi.c (-2)
  • (modified) clang/test/Driver/mips-abicalls-warning.c (-1)
  • (modified) clang/test/Driver/mips-cs.cpp (-2)
  • (modified) clang/test/Driver/mips-fsf.cpp (-2)
  • (modified) clang/test/Driver/mips-gpopt-warning.c (-1)
  • (modified) clang/test/Driver/mips-img-v2.cpp (-2)
  • (modified) clang/test/Driver/mips-img.cpp (-2)
  • (modified) clang/test/Driver/mips-indirect-branch.c (-1)
  • (modified) clang/test/Driver/mips-mti-linux.c (-1)
  • (modified) clang/test/Driver/msan.c (-2)
  • (modified) clang/test/Driver/nvptx-cuda-system-arch.c (-2)
  • (modified) clang/test/Driver/openmp-offload-headers.c (-3)
  • (modified) clang/test/Driver/openmp-offload-infer.c (-4)
  • (modified) clang/test/Driver/openmp-offload-jit.c (-4)
  • (modified) clang/test/Driver/openmp-offload.c (-4)
  • (modified) clang/test/Driver/openmp-system-arch.c (-3)
  • (modified) clang/test/Driver/ppc-dependent-options.cpp (-1)
  • (modified) clang/test/Driver/ppc-float-abi-warning.cpp (-1)
  • (modified) clang/test/Driver/ppc-unsupported.c (-1)
  • (modified) clang/test/Driver/riscv32-toolchain-extra.c (+1-1)
  • (modified) clang/test/Driver/riscv64-toolchain-extra.c (+1-1)
  • (modified) clang/test/Driver/rocm-detect.cl (-2)
  • (modified) clang/test/Driver/rocm-detect.hip (-2)
  • (modified) clang/test/Driver/rocm-device-libs.cl (-1)
  • (modified) clang/test/Driver/save-temps.c (-3)
  • (modified) clang/test/Driver/sysroot.c (-2)
  • (modified) clang/test/Driver/target-id-macros.cl (-3)
  • (modified) clang/test/Driver/target-id.cl (-3)
  • (modified) clang/test/Driver/thinlto.cu (-3)
  • (modified) clang/test/Driver/tsan.c (-2)
  • (modified) clang/test/Driver/ve-toolchain.c (-1)
  • (modified) clang/test/Driver/ve-toolchain.cpp (-1)
diff --git a/clang/test/Driver/aarch64-outliner.c b/clang/test/Driver/aarch64-outliner.c
index 06e5de11ec49e..c5d28d121513f 100644
--- a/clang/test/Driver/aarch64-outliner.c
+++ b/clang/test/Driver/aarch64-outliner.c
@@ -1,4 +1,3 @@
-// REQUIRES: aarch64-registered-target
 // RUN: %clang --target=aarch64 -moutline -S %s -### 2>&1 | FileCheck %s -check-prefix=ON
 // RUN: %clang --target=aarch64_be -moutline -S %s -### 2>&1 | FileCheck %s -check-prefix=ON
 // ON: "-mllvm" "-enable-machine-outliner"
diff --git a/clang/test/Driver/amdgcn-gz-options.cl b/clang/test/Driver/amdgcn-gz-options.cl
index 8ffd58af509db..ece3ac17e8018 100644
--- a/clang/test/Driver/amdgcn-gz-options.cl
+++ b/clang/test/Driver/amdgcn-gz-options.cl
@@ -1,4 +1,4 @@
-// REQUIRES: zlib, amdgpu-registered-target
+// REQUIRES: zlib
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa -gz=none -x assembler %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_NONE %s
 // RUN: %clang -### -target amdgcn-amd-amdhsa -gz=none -nogpulib %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_NONE %s
diff --git a/clang/test/Driver/amdgpu-hip-system-arch.c b/clang/test/Driver/amdgpu-hip-system-arch.c
index 6b2955c274135..a46077b38fac0 100644
--- a/clang/test/Driver/amdgpu-hip-system-arch.c
+++ b/clang/test/Driver/amdgpu-hip-system-arch.c
@@ -1,6 +1,4 @@
 // REQUIRES: system-linux
-// REQUIRES: x86-registered-target
-// REQUIRES: amdgpu-registered-target
 // REQUIRES: shell
 
 // RUN: mkdir -p %t
diff --git a/clang/test/Driver/amdgpu-invalid-target-id.s b/clang/test/Driver/amdgpu-invalid-target-id.s
index 5d4b188f9ef1d..7d1d8e4772338 100644
--- a/clang/test/Driver/amdgpu-invalid-target-id.s
+++ b/clang/test/Driver/amdgpu-invalid-target-id.s
@@ -1,6 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: amdgpu-registered-target
-
 // RUN: not %clang -target amdgcn-amd-amdhsa \
 // RUN:   -mcpu=gfx908xnack -nostdlib \
 // RUN:   %s 2>&1 | FileCheck -check-prefix=NOPLUS %s
diff --git a/clang/test/Driver/amdgpu-macros.cl b/clang/test/Driver/amdgpu-macros.cl
index 3dbe10dfcf1dc..a878a7decee95 100644
--- a/clang/test/Driver/amdgpu-macros.cl
+++ b/clang/test/Driver/amdgpu-macros.cl
@@ -1,4 +1,3 @@
-// REQUIRES: amdgpu-registered-target
 // Check that appropriate macros are defined for every supported AMDGPU
 // "-target" and "-mcpu" options.
 
diff --git a/clang/test/Driver/amdgpu-openmp-system-arch-fail.c b/clang/test/Driver/amdgpu-openmp-system-arch-fail.c
index f760683e47611..85c82e4598cb1 100644
--- a/clang/test/Driver/amdgpu-openmp-system-arch-fail.c
+++ b/clang/test/Driver/amdgpu-openmp-system-arch-fail.c
@@ -1,6 +1,4 @@
 // REQUIRES: system-linux
-// REQUIRES: x86-registered-target
-// REQUIRES: amdgpu-registered-target
 // REQUIRES: shell
 
 // RUN: mkdir -p %t
diff --git a/clang/test/Driver/amdgpu-openmp-toolchain.c b/clang/test/Driver/amdgpu-openmp-toolchain.c
index 849afb871ddbf..ef58c2c4e3f3a 100644
--- a/clang/test/Driver/amdgpu-openmp-toolchain.c
+++ b/clang/test/Driver/amdgpu-openmp-toolchain.c
@@ -1,5 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: amdgpu-registered-target
 // RUN:   %clang -### --target=x86_64-unknown-linux-gnu -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa \
 // RUN:          -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906 --libomptarget-amdgpu-bc-path=%S/Inputs/hip_dev_lib -nogpulib %s 2>&1 \
 // RUN:   | FileCheck %s
diff --git a/clang/test/Driver/arm-float-abi-runtime-path.c b/clang/test/Driver/arm-float-abi-runtime-path.c
index d4a48601a04b4..029fe19690f9b 100644
--- a/clang/test/Driver/arm-float-abi-runtime-path.c
+++ b/clang/test/Driver/arm-float-abi-runtime-path.c
@@ -1,8 +1,6 @@
 /// Check that libraries built with the per target runtime directory layout
 /// are selected correctly when using variations of Arm triples.
 
-// REQUIRES: arm-registered-target
-
 // RUN: %clang %s --target=arm-unknown-linux-gnueabihf -print-runtime-dir \
 // RUN:        -resource-dir=%S/Inputs/arm_float_abi_runtime_path 2>&1 | FileCheck -check-prefix=ARMHF %s
 /// "armv7l" should be normalised to just "arm".
diff --git a/clang/test/Driver/arm-float-abi.c b/clang/test/Driver/arm-float-abi.c
index 806ef0fbd93e6..35bd71415774c 100644
--- a/clang/test/Driver/arm-float-abi.c
+++ b/clang/test/Driver/arm-float-abi.c
@@ -1,4 +1,3 @@
-// REQUIRES: arm-registered-target
 // RUN: not %clang %s -target armv7-apple-ios -mfloat-abi=hard 2>&1 | FileCheck -check-prefix=ARMV7-ERROR %s
 // RUN: %clang %s -target armv7-apple-ios -mfloat-abi=softfp -### 2>&1 | FileCheck -check-prefix=NOERROR %s
 // RUN: %clang %s -arch armv7 -target thumbv7-apple-darwin-eabi -mfloat-abi=hard -### 2>&1 | FileCheck -check-prefix=NOERROR %s
diff --git a/clang/test/Driver/arm-machine-outliner.c b/clang/test/Driver/arm-machine-outliner.c
index 6ac82838323a9..a1e705cb60a1b 100644
--- a/clang/test/Driver/arm-machine-outliner.c
+++ b/clang/test/Driver/arm-machine-outliner.c
@@ -1,4 +1,3 @@
-// REQUIRES: arm-registered-target
 // RUN: %clang -target armv7-linux-gnueabihf -moutline -c %s -### 2>&1 | FileCheck %s -check-prefix=ON
 // ON: "-mllvm" "-enable-machine-outliner"
 // RUN: %clang -target armv7-linux-gnueabihf -flto -moutline %s -### 2>&1 | FileCheck %s -check-prefix=ON-LTO
diff --git a/clang/test/Driver/cl-options.cu b/clang/test/Driver/cl-options.cu
index 8b0c2ba421b36..b241ec6672d85 100644
--- a/clang/test/Driver/cl-options.cu
+++ b/clang/test/Driver/cl-options.cu
@@ -3,9 +3,6 @@
 // Note: %s must be preceded by --, otherwise it may be interpreted as a
 // command-line option, e.g. on Mac where %s is commonly under /Users.
 
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-
 // -stack-protector should not be passed to device-side CUDA compilation
 // RUN: not %clang_cl -### -nocudalib -nocudainc -- %s 2>&1 | FileCheck -check-prefix=GS-default %s
 // GS-default: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda"
diff --git a/clang/test/Driver/clang-offload-bundler-zlib.c b/clang/test/Driver/clang-offload-bundler-zlib.c
index fff7a0f545686..7e5857296756c 100644
--- a/clang/test/Driver/clang-offload-bundler-zlib.c
+++ b/clang/test/Driver/clang-offload-bundler-zlib.c
@@ -1,5 +1,4 @@
 // REQUIRES: zlib && !zstd
-// REQUIRES: x86-registered-target
 // UNSUPPORTED: target={{.*}}-darwin{{.*}}, target={{.*}}-aix{{.*}}, target={{.*}}-zos{{.*}}
 
 //
diff --git a/clang/test/Driver/clang-offload-bundler-zstd.c b/clang/test/Driver/clang-offload-bundler-zstd.c
index d01d9659a68dd..667d9554daec7 100644
--- a/clang/test/Driver/clang-offload-bundler-zstd.c
+++ b/clang/test/Driver/clang-offload-bundler-zstd.c
@@ -1,5 +1,4 @@
 // REQUIRES: zstd
-// REQUIRES: x86-registered-target
 // UNSUPPORTED: target={{.*}}-darwin{{.*}}, target={{.*}}-aix{{.*}}, target={{.*}}-zos{{.*}}
 
 //
diff --git a/clang/test/Driver/compress-noias.c b/clang/test/Driver/compress-noias.c
index 24bfa18c8d704..472b6327eff4c 100644
--- a/clang/test/Driver/compress-noias.c
+++ b/clang/test/Driver/compress-noias.c
@@ -1,5 +1,4 @@
 // REQUIRES: zlib
-// REQUIRES: x86-registered-target
 
 // RUN: %clang -### -target i686-unknown-linux-gnu -fno-integrated-as -Wa,-compress-debug-sections -c %s 2>&1 | FileCheck -check-prefix CHECK-_COMPRESS_DEBUG_SECTIONS %s
 // CHECK-_COMPRESS_DEBUG_SECTIONS: "-compress-debug-sections"
diff --git a/clang/test/Driver/cuda-arch-translation.cu b/clang/test/Driver/cuda-arch-translation.cu
index f37964d87c66a..ff97f2dbda6c5 100644
--- a/clang/test/Driver/cuda-arch-translation.cu
+++ b/clang/test/Driver/cuda-arch-translation.cu
@@ -1,8 +1,5 @@
 // Tests that "sm_XX" gets correctly converted to "compute_YY" when we invoke
 // fatbinary.
-//
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
 
 // RUN: %clang -### --target=x86_64-linux-gnu -c --cuda-gpu-arch=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda %s 2>&1 \
 // RUN: | FileCheck -check-prefixes=CUDA,SM20 %s
diff --git a/clang/test/Driver/cuda-bad-arch.cu b/clang/test/Driver/cuda-bad-arch.cu
index 35a56a8bef0f0..8c8c5c3401329 100644
--- a/clang/test/Driver/cuda-bad-arch.cu
+++ b/clang/test/Driver/cuda-bad-arch.cu
@@ -1,7 +1,4 @@
 // Checks errors generated by passing a bad value for --cuda-gpu-arch.
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-// REQUIRES: amdgpu-registered-target
 
 // RUN: not %clang -### --target=x86_64-linux-gnu --cuda-gpu-arch=compute_20 -c --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda %s 2>&1 \
 // RUN: | FileCheck -check-prefix BAD %s
diff --git a/clang/test/Driver/cuda-bail-out.cu b/clang/test/Driver/cuda-bail-out.cu
index ec34711e51ae8..6f9a877e3c0f7 100644
--- a/clang/test/Driver/cuda-bail-out.cu
+++ b/clang/test/Driver/cuda-bail-out.cu
@@ -1,8 +1,5 @@
 // Test clang driver bails out after one error during CUDA compilation.
 
-// REQUIRES: powerpc-registered-target
-// REQUIRES: nvptx-registered-target
-
 #ifdef FORCE_ERROR
 #error compilation failed
 #endif
diff --git a/clang/test/Driver/cuda-bindings.cu b/clang/test/Driver/cuda-bindings.cu
index e130e08f20152..8ee1884936c06 100644
--- a/clang/test/Driver/cuda-bindings.cu
+++ b/clang/test/Driver/cuda-bindings.cu
@@ -9,9 +9,6 @@
 // way. Instead we check whether we've generated a permanent name on
 // device side, which appends '-device-cuda-<triple>' suffix.
 
-// REQUIRES: powerpc-registered-target
-// REQUIRES: nvptx-registered-target
-
 //
 // Test single gpu architecture with complete compilation.
 // No intermediary device files should have "-device-cuda..." in the name.
diff --git a/clang/test/Driver/cuda-constructor-alias.cu b/clang/test/Driver/cuda-constructor-alias.cu
index 6639420efa3e6..b7867e095f27f 100644
--- a/clang/test/Driver/cuda-constructor-alias.cu
+++ b/clang/test/Driver/cuda-constructor-alias.cu
@@ -1,6 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-
 // Check that we don't pass -mconstructor-aliases to CUDA device-side
 // compilation, but we do pass it to host-side compilation.
 
diff --git a/clang/test/Driver/cuda-cross-compiling.c b/clang/test/Driver/cuda-cross-compiling.c
index 203bc063a0106..1dc4520f485db 100644
--- a/clang/test/Driver/cuda-cross-compiling.c
+++ b/clang/test/Driver/cuda-cross-compiling.c
@@ -1,8 +1,6 @@
 // Tests the driver when targeting the NVPTX architecture directly without a
 // host toolchain to perform CUDA mappings.
 
-// REQUIRES: nvptx-registered-target
-
 //
 // Test the generated phases when targeting NVPTX.
 //
diff --git a/clang/test/Driver/cuda-detect-path.cu b/clang/test/Driver/cuda-detect-path.cu
index 95b9b288a8d7c..8d249bd4c96d5 100644
--- a/clang/test/Driver/cuda-detect-path.cu
+++ b/clang/test/Driver/cuda-detect-path.cu
@@ -1,5 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
 // This tests uses the PATH environment variable.
 // REQUIRES: !system-windows
 
diff --git a/clang/test/Driver/cuda-detect.cu b/clang/test/Driver/cuda-detect.cu
index 67af470018ff9..23b6ba2fcc09d 100644
--- a/clang/test/Driver/cuda-detect.cu
+++ b/clang/test/Driver/cuda-detect.cu
@@ -1,6 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-//
 // Check that we properly detect CUDA installation.
 // RUN: %clang -v --target=i386-unknown-linux \
 // RUN:   --sysroot=%S/no-cuda-there --cuda-path-ignore-env 2>&1 | FileCheck %s -check-prefix NOCUDA
diff --git a/clang/test/Driver/cuda-external-tools.cu b/clang/test/Driver/cuda-external-tools.cu
index 9ada0cf8595dc..0633c7bceac05 100644
--- a/clang/test/Driver/cuda-external-tools.cu
+++ b/clang/test/Driver/cuda-external-tools.cu
@@ -1,8 +1,5 @@
 // Tests that ptxas and fatbinary are invoked correctly during CUDA
 // compilation.
-//
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
 
 // Regular compiles with -O{0,1,2,3,4,fast}.  -O4 and -Ofast map to ptxas O3.
 // RUN: %clang -### --target=x86_64-linux-gnu -O0 -c %s 2>&1 \
diff --git a/clang/test/Driver/cuda-macosx.cu b/clang/test/Driver/cuda-macosx.cu
index d01299f9f7d27..d26dd17ff950a 100644
--- a/clang/test/Driver/cuda-macosx.cu
+++ b/clang/test/Driver/cuda-macosx.cu
@@ -1,6 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-//
 // RUN: %clang -v --target=i386-apple-macosx \
 // RUN:   --sysroot=%S/Inputs/CUDA-macosx --cuda-path-ignore-env 2>&1 | FileCheck %s
 
diff --git a/clang/test/Driver/cuda-march.cu b/clang/test/Driver/cuda-march.cu
index 25fd6f3a10f2a..2dbb9cdf6f589 100644
--- a/clang/test/Driver/cuda-march.cu
+++ b/clang/test/Driver/cuda-march.cu
@@ -1,9 +1,6 @@
 // Checks that cuda compilation does the right thing when passed -march.
 // (Specifically, we want to pass it to host compilation, but not to device
 // compilation or ptxas!)
-//
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
 
 // RUN: %clang -### --target=x86_64-linux-gnu -c \
 // RUN: -nogpulib -nogpuinc -march=haswell %s 2>&1 | FileCheck %s
diff --git a/clang/test/Driver/cuda-omp-unsupported-debug-options.cu b/clang/test/Driver/cuda-omp-unsupported-debug-options.cu
index 8e1bb2e496c74..cc6a538d7a7ba 100644
--- a/clang/test/Driver/cuda-omp-unsupported-debug-options.cu
+++ b/clang/test/Driver/cuda-omp-unsupported-debug-options.cu
@@ -1,5 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
 // REQUIRES: zlib
 
 // RUN: %clang -### --target=x86_64-linux-gnu --offload-arch=sm_52 -nogpulib -nogpuinc -c %s -g -gz 2>&1 \
diff --git a/clang/test/Driver/cuda-openmp-driver.cu b/clang/test/Driver/cuda-openmp-driver.cu
index 8f2d8587e2dad..a1ca987eb9d22 100644
--- a/clang/test/Driver/cuda-openmp-driver.cu
+++ b/clang/test/Driver/cuda-openmp-driver.cu
@@ -1,6 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-
 // RUN: %clang -### -target x86_64-linux-gnu -nocudalib -ccc-print-bindings -fgpu-rdc \
 // RUN:        --offload-new-driver --offload-arch=sm_35 --offload-arch=sm_70 %s 2>&1 \
 // RUN: | FileCheck -check-prefix BINDINGS %s
diff --git a/clang/test/Driver/cuda-options.cu b/clang/test/Driver/cuda-options.cu
index 8999a6618fe1f..67facf77f6c68 100644
--- a/clang/test/Driver/cuda-options.cu
+++ b/clang/test/Driver/cuda-options.cu
@@ -1,6 +1,4 @@
 // Tests CUDA compilation pipeline construction in Driver.
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
 
 // Simple compilation case. Compile device-side to PTX assembly and make sure
 // we use it on the host side.
diff --git a/clang/test/Driver/cuda-output-asm.cu b/clang/test/Driver/cuda-output-asm.cu
index ed1aeadc243a5..6b944d1891724 100644
--- a/clang/test/Driver/cuda-output-asm.cu
+++ b/clang/test/Driver/cuda-output-asm.cu
@@ -1,8 +1,5 @@
 // Tests CUDA compilation with -S and -emit-llvm.
 
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-
 // RUN: %clang -### -S --target=x86_64-linux-gnu --cuda-gpu-arch=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda %s 2>&1 \
 // RUN:   | FileCheck -check-prefix HOST -check-prefix SM20 %s
 // RUN: %clang -### -S --target=x86_64-linux-gnu --cuda-host-only -o foo.s --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda %s 2>&1 \
diff --git a/clang/test/Driver/cuda-phases.cu b/clang/test/Driver/cuda-phases.cu
index 85b1a550524d2..8b91a1d5a7fcf 100644
--- a/clang/test/Driver/cuda-phases.cu
+++ b/clang/test/Driver/cuda-phases.cu
@@ -4,9 +4,6 @@
 // - Host/device-only compilation;
 // - User-requested final phase - binary or assembly.
 
-// REQUIRES: powerpc-registered-target
-// REQUIRES: nvptx-registered-target
-//
 // Test single gpu architecture with complete compilation.
 //
 // Test CUDA NVPTX phases.
diff --git a/clang/test/Driver/cuda-ptxas-path.cu b/clang/test/Driver/cuda-ptxas-path.cu
index 87b19d9d4d616..f36dcc94558f1 100644
--- a/clang/test/Driver/cuda-ptxas-path.cu
+++ b/clang/test/Driver/cuda-ptxas-path.cu
@@ -1,6 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-
 // RUN: %clang -### --target=i386-unknown-linux \
 // RUN:   --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda \
 // RUN:   --ptxas-path=/some/path/to/ptxas %s 2>&1 \
diff --git a/clang/test/Driver/cuda-version-check.cu b/clang/test/Driver/cuda-version-check.cu
index dc313e928c7d2..9eceb928ffabd 100644
--- a/clang/test/Driver/cuda-version-check.cu
+++ b/clang/test/Driver/cuda-version-check.cu
@@ -1,6 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-
 // RUN: not %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_20 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \
 // RUN:    FileCheck %s --check-prefix=OK
 // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_20 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2>&1 %s | \
diff --git a/clang/test/Driver/cuda-windows.cu b/clang/test/Driver/cuda-windows.cu
index 02d6a55808d1c..4459e809072d9 100644
--- a/clang/test/Driver/cuda-windows.cu
+++ b/clang/test/Driver/cuda-windows.cu
@@ -1,6 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-//
 // RUN: %clang -v --target=i386-pc-windows-msvc \
 // RUN:   --sysroot=%S/Inputs/CUDA-windows 2>&1 %s -### | FileCheck %s
 // RUN: %clang -v --target=i386-pc-windows-mingw32 \
diff --git a/clang/test/Driver/driverkit-arm64.c b/clang/test/Driver/driverkit-arm64.c
index 125df688976e6..1f60c0aec7dd3 100644
--- a/clang/test/Driver/driverkit-arm64.c
+++ b/clang/test/Driver/driverkit-arm64.c
@@ -1,4 +1,3 @@
-// REQUIRES: aarch64-registered-target
 // RUN: %clang %s -target arm64-apple-driverkit -### 2>&1 | FileCheck %s
 
 // CHECK: "-target-cpu" "apple-a7"
diff --git a/clang/test/Driver/driverkit-arm64e.c b/clang/test/Driver/driverkit-arm64e.c
index d9ace1ea9e137..29f90bdc99ec0 100644
--- a/clang/test/Driver/driverkit-arm64e.c
+++ b/clang/test/Driver/driverkit-arm64e.c
@@ -1,4 +1,3 @@
-// REQUIRES: aarch64-registered-target
 // RUN: %clang %s -target arm64e-apple-driverkit -### 2>&1 | FileCheck %s
 
 // CHECK: "-target-cpu" "apple-a12"
diff --git a/clang/test/Driver/driverkit-cplusplus.cpp b/clang/test/Driver/driverkit-cplusplus.cpp
index 9f2e49f890316..717a95e6b9825 100644
--- a/clang/test/Driver/driverkit-cplusplus.cpp
+++ b/clang/test/Driver/driverkit-cplusplus.cpp
@@ -1,4 +1,3 @@
-// REQUIRES: x86-registered-target
 // RUN: %clang %s -target x86_64-apple-driverkit19.0 -fsyntax-only
 
 #if __cplusplus != 201703L
diff --git a/clang/test/Driver/driverkit-exceptions.cpp b/clang/test/Driver/driverkit-exceptions.cpp
index 76a39770338e6..2d06d023242bb 100644
--- a/clang/test/Driver/driverkit-exceptions.cpp
+++ b/clang/test/Driver/driverkit-exceptions.cpp
@@ -1,4 +1,3 @@
-// REQUIRES: x86-registered-target
 // RUN: %clang %s -target x86_64-apple-driverkit19.0 -### 2>&1 | FileCheck %s -check-prefix=DEFAULT
 // RUN: %clang %s -target x86_64-apple-driverkit19.0 -fexceptions -### 2>&1 | FileCheck %s -check-prefix=USERPROVIDED
 
diff --git a/clang/test/Driver/driverkit-path.c b/clang/test/Driver/driverkit-path.c
index 9699b9c01f4e8..3caae382d65bb 100644
--- a/clang/test/Driver/driverkit-path.c
+++ b/clang/test/Driver/driverkit-path.c
@@ -1,4 +1,3 @@
-// REQUIRES: x86-registered-target
 // UNSUPPORTED: system-windows
 //   Windows is unsupported because we use the Unix path separator `\`.
 
diff --git a/clang/test/Driver/driverkit-rtti.cpp b/clang/test/Driver/driverkit-rtti.cpp
index 3d94ea09256e7..6fadc06ea1d1d 100644
--- a/clang/test/Driver/driverkit-rtti.cpp
+++ b/clang/test/Driver/driverkit-rtti.cpp
@@ -1,4 +1,3 @@
-// REQUIRES: x86-registered-target
 // RUN: %clang %s -target x86_64-apple-driverkit19.0 -### 2>&1 | FileCheck %s
 
 int main() { return 0; }
diff --git a/clang/test/Driver/driverkit-target-cpu.c b/clang/test/Driver/driverkit-target-cpu.c
index f69e5edec0c9b..b1a6232c07351 100644
--- a/clang/test/Driver/driverkit-target-cpu.c
+++ b/clang/test/Driver/driverkit-target-cpu.c
@@ -1,4 +1,3 @@
-// REQUIRES: x86-registered-target
 // RUN: %clang %s -target x86_64-apple-driverkit19.0 -### 2>&1 | FileCheck %s
 
 int main() { return 0; }
diff --git a/clang/test/Driver/dwarf-target-version-clamp.cu b/clang/test/Driver/dwarf-target-version-clamp.cu
index d9dbbe62cfb2f..910e9cb82a1cc 100644
--- a/clang/test/Driver/dwarf-target-version-clamp.cu
+++ b/clang/test/Driver/dwarf-target-version-clamp.cu
@@ -1,6 +1,3 @@
-// REQUIRES: x86-registered-target
-// REQUIRES: nvptx-registered-target
-
 // Verify that DWARF version is properly clamped for nvptx, but not for the host.
 // RUN: %clang -### --target=x86_64-linux-gnu -nogpulib -nogpuinc -c %s -gdwarf-5 -gembed-source ...
[truncated]

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.

I've wondered about these as well, there might also be some OpenMP tests that have requries powerpc-registered-target or similar that could be removed. I guess we'll see what the CI thinks with this patch.

Copy link
Member

@arichardson arichardson left a comment

Choose a reason for hiding this comment

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

In the past I've cleaned up some local unnecessary REQUIRES: foo-registered-target in a downstream fork, good to see this being fixed upstream as well. I often build only a subset of targets so it's good to see more test coverage for that configuration.

@@ -1,6 +1,4 @@
// REQUIRES: system-linux
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated, but I don't see why this would fail on e.g. a FreeBSD host. Maybe it should be !WINDOWS? Although that should also be handled by REQUIRES: shell

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I hope you feel empowered to post more cleanup patches upstream!

@pogo59 pogo59 merged commit 12949c9 into llvm:main Jun 3, 2024
12 checks passed
@pogo59
Copy link
Collaborator Author

pogo59 commented Jun 3, 2024

I'm seeing two bot failures:
https://lab.llvm.org/buildbot/#/builders/60/builds/17462
https://lab.llvm.org/buildbot/#/builders/119/builds/18845
both for sysroot.c.
These are Arm/AArch64 Windows bots, based on the names, which is not an environment I have available. I cannot reproduce the failure on X86 Windows. The best I can do is mark them UNSUPPORTED: system-windows to get the bots green again.

pogo59 added a commit to pogo59/llvm-project that referenced this pull request Jun 3, 2024
After llvm#94055 this test failed on ARM/AArch64-hosted Windows,
but it's not clear why.
pogo59 added a commit that referenced this pull request Jun 3, 2024
After #94055 this test failed on ARM/AArch64-hosted Windows, but it's
not clear why.
@vvereschaka
Copy link
Contributor

vvereschaka commented Jun 3, 2024

@pogo59.

these two bots support ONLY ARM and Aarch64 targets (one target for the single bot). Also, this is the cross platform builders.
When you remove a requirement of the MIPS target for the mips's test it will get executed for the arm/aarch64 toolchain environment and most likely it will get failed. MIPS and ARM are the different targets, right? The same thing for the hecagon's tests. You need to apply the appropriate target requirements for the target depended tests to allow their execution only in the proper environment.

The best I can do is mark them UNSUPPORTED: system-windows to get the bots green again.

This is not a good idea. You will disable these tests for the appropriate cross builders for no reason and they will became useless for them. I would strongly recommend to revert #94253 and assign the correct target requirements for the failed tests (or restore the previous ones).

@pogo59
Copy link
Collaborator Author

pogo59 commented Jun 3, 2024

Correctly written Driver tests do not depend on any particular target. All Driver code relevant to all targets is present in all cases.

Exactly one test (out of 133) was failing on exactly two bots. I'm not saying that marking that test UNSUPPORTED for Windows was the best thing; it was expedient, to get the bots green again while minimizing the hosts where the test would not run.

If you can show me the code path that is causing the failure, I can probably make a more appropriate change. But again, it does not depend on the target. The test is working fine on every other bot; it does not depend on having the X86 target present.

@pogo59
Copy link
Collaborator Author

pogo59 commented Jun 3, 2024

FTR, when I say I could not reproduce on X86 Windows, exactly what I did is build on an X86 Windows host but include only the AArch64 target. The test passed.

@jrtc27
Copy link
Collaborator

jrtc27 commented Jun 3, 2024

Looks like the buildbots' -DDEFAULT_SYSROOT strikes again (boo...). I think adding --sysroot="" is a common way to handle this for tests.

@vvereschaka
Copy link
Contributor

FTR, when I say I could not reproduce on X86 Windows, exactly what I did is build on an X86 Windows host but include only the AArch64 target. The test passed.

got it, thank you. I took a closer look to the failures and I found that most of them (except Clang::hexagon-toolchain-elf.c) have failed because of --sysroot

...
ld.lld "--sysroot=c:/buildbot/fs/jetson-agx-ubuntu" "--sysroot=c:/buildbot/fs/jetson-agx-ubuntu" ...

does not look good.

pogo59 added a commit to pogo59/llvm-project that referenced this pull request Jun 3, 2024
A DEFAULT_SYSROOT interfered with the test, apparently.
See llvm#94055.
pogo59 added a commit that referenced this pull request Jun 3, 2024
A DEFAULT_SYSROOT interfered with the test, apparently. See #94055.
@MaskRay
Copy link
Member

MaskRay commented Jun 3, 2024

Looks like the buildbots' -DDEFAULT_SYSROOT strikes again (boo...). I think adding --sysroot="" is a common way to handle this for tests.

I think DEFAULT_SYSROOT should be phased out. Downstream users can customize CMake DEFAULT_SYSROOT to set the default --sysroot=, but there should be no expectation that all tests will pass. (Ensuring all clang/test/Driver tests pass with a custom DEFAULT_SYSROOT is an undue burden.) https://reviews.llvm.org/D158218

A CMake change can be made to let DEFAULT_SYSROOT install $default_triple.cfg beside clang and issue a deprecation warning. https://blogs.gentoo.org/mgorny/2022/10/07/clang-in-gentoo-now-sets-default-runtimes-via-config-file/

Unfortunately, WebAssembly/wasi-sdk has a reliance on this behavior https://reviews.llvm.org/D76653 WebAssembly/wasi-sdk#171
@sunfishcode @sbc100

@MaskRay
Copy link
Member

MaskRay commented Jun 3, 2024

The best I can do is mark them UNSUPPORTED: system-windows to get the bots green again.

This is not a good idea. You will disable these tests for the appropriate cross builders for no reason and they will became useless for them. I would strongly recommend to revert #94253 and assign the correct target requirements for the failed tests (or restore the previous ones).

@vvereschaka // UNSUPPORTED: system-windows was a fairly reasonable workaround, after the previously imprecise // REQUIRES: x86-registered-target had been removed. (It seems that there is an arm/aarch64 window bot that does not enable x86 targets.)

#94276 seems to fix the test properly.


I think requiring all driver tests pass with a custom DEFAULT_SYSROOT is an undue burden.
Do you know why llvm-zorg/buildbot/osuosl/master/config/builders.py llvm-clang-win-x-aarch64 needs to set DEFAULT_SYSROOT?
I think it should migrate to https://clang.llvm.org/docs/UsersManual.html#configuration-files instead.

@vvereschaka
Copy link
Contributor

vvereschaka commented Jun 3, 2024

@MaskRay

// UNSUPPORTED: system-windows was a fairly reasonable workaround, after the previously imprecise // REQUIRES: x86-registered-target had been removed.

I'm not quite agree here, sorry. That kind of workarounds disable the tests for the cross platform builders on the Windows build hosts, but they could need that kind of test even more than the other build hosts on my sight. Sure, this test didn't work for Arm/aarch64 builders before and this workaround does not change anything for them, but this should not be like that I suppose.

(It seems that there is an arm/aarch64 window bot that does not enable x86 targets.)

Correct. These bots enable only Arm/Aarch64 targets.

#94276 seems to fix the test properly.

yes, it fixes clang/test/Driver/sysroot.c test

@vvereschaka
Copy link
Contributor

vvereschaka commented Jun 3, 2024

I think requiring all driver tests pass with a custom DEFAULT_SYSROOT is an undue burden.
Do you know why llvm-zorg/buildbot/osuosl/master/config/builders.py llvm-clang-win-x-aarch64 needs to set DEFAULT_SYSROOT?

This is the arm toolchain builders. They build a whole toolchain including the libc++/libc++abi/libunwind libraries for the Arm targets. Also they build the library tests for the target ARM platform. All of those requires the target's sysroot (Arm/Aarch64 Ubuntu Linux in these cases) to build the executables. To avoid passing --sysroot through a bunch of CMake variables for the libraries and their tests the DEFAULT_SYSROOT cmake var was used (it was defined for that cases as far as I understood).

@MaskRay
Copy link
Member

MaskRay commented Jun 3, 2024

I think requiring all driver tests pass with a custom DEFAULT_SYSROOT is an undue burden.
Do you know why llvm-zorg/buildbot/osuosl/master/config/builders.py llvm-clang-win-x-aarch64 needs to set DEFAULT_SYSROOT?

This is the arm toolchain builders. They build a whole toolchain including the libc++/libc++abi/libunwind libraries for the Arm targets. Also they build the library tests for the target ARM platform. All of those requires the target's sysroot (Arm/Aarch64 Ubuntu Linux in these cases) to build the executables. To avoid passing --sysroot through a bunch of CMake variables for the libraries and their tests the DEFAULT_SYSROOT cmake var was used (it was defined for that cases as far as I understood).

Filed #94284 to track the removal of DEFAULT_SYSROOT for llvm-clang-win-x-{armv7l,aarch64}-release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AMDGPU backend:RISC-V clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants