Files
clang-p2996/clang/test/Driver/hip-toolchain-rdc-flto-partitions.hip
Joseph Huber e9d517d183 [Clang] Handle -flto-partitions generically and forward it properly (#133283)
Summary:
The https://github.com/llvm/llvm-project/pull/128509 patch introduced
`--flto-partitions`. This was marked as a HIP only argument, and was
also spelled and handled incorrectly for an `-f` option. This patch
makes the handling generic for `ld.lld` consumers.

This also fixes some issues with emitting the flags being put after the
default arguments, preventing users from overriding them. Also, forwards
things properly for the new driver so we can test this.
2025-03-27 14:31:35 -05:00

36 lines
1.6 KiB
Plaintext

// RUN: %clang -### --target=x86_64-linux-gnu \
// RUN: -x hip --cuda-gpu-arch=gfx803 -flto-partitions=42 \
// RUN: --no-offload-new-driver --emit-static-lib -nogpulib \
// RUN: -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck %s --check-prefix=FIXED-PARTS
// FIXED-PARTS-NOT: "*.llvm-link"
// FIXED-PARTS-NOT: ".*opt"
// FIXED-PARTS-NOT: ".*llc"
// FIXED-PARTS: [[LLD: ".*lld.*"]] {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
// FIXED-PARTS-SAME: "--lto-partitions=42"
// FIXED-PARTS-SAME: "-plugin-opt=mcpu=gfx803"
// FIXED-PARTS-SAME: "-o" "{{.*out}}" "{{.*bc}}"
// RUN: not %clang -### --target=x86_64-linux-gnu \
// RUN: -x hip --cuda-gpu-arch=gfx803 -flto-partitions=a \
// RUN: --no-offload-new-driver --emit-static-lib -nogpulib \
// RUN: -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck %s --check-prefix=LTO_PARTS_INV0
// LTO_PARTS_INV0: clang: error: invalid integral value 'a' in '-flto-partitions=a'
// RUN: not %clang -### --target=x86_64-linux-gnu \
// RUN: -x hip --cuda-gpu-arch=gfx803 -flto-partitions=0 \
// RUN: --no-offload-new-driver --emit-static-lib -nogpulib \
// RUN: -fuse-ld=lld -B%S/Inputs/lld -fgpu-rdc -nogpuinc \
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \
// RUN: %S/Inputs/hip_multiple_inputs/b.hip \
// RUN: 2>&1 | FileCheck %s --check-prefix=LTO_PARTS_INV1
// LTO_PARTS_INV1: clang: error: invalid integral value '0' in '-flto-partitions=0'