Author: Yaxun (Sam) Liu Date: 2025-03-06T22:46:41-05:00 New Revision: 267403442264959f6b06e227ff450c385f4b3ef2
URL: https://github.com/llvm/llvm-project/commit/267403442264959f6b06e227ff450c385f4b3ef2 DIFF: https://github.com/llvm/llvm-project/commit/267403442264959f6b06e227ff450c385f4b3ef2.diff LOG: Reland "[HIP] Use original file path for CUID" (#111885) This patch fixes the buildbots failure of lit tests on MacOS. Since clang driver options depend on toolchain, we cannot hardcode CUID hash. On MacOS there is an extra -mlinker-version= option. Added: Modified: clang/lib/Driver/Driver.cpp clang/test/Driver/hip-cuid-hash.hip Removed: ################################################################################ diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index eca96c1cce7f7..e998c94aeacd1 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -226,10 +226,7 @@ std::string CUIDOptions::getCUID(StringRef InputFile, else if (UseCUID == Kind::Hash) { llvm::MD5 Hasher; llvm::MD5::MD5Result Hash; - SmallString<256> RealPath; - llvm::sys::fs::real_path(InputFile, RealPath, - /*expand_tilde=*/true); - Hasher.update(RealPath); + Hasher.update(InputFile); for (auto *A : Args) { if (A->getOption().matches(options::OPT_INPUT)) continue; diff --git a/clang/test/Driver/hip-cuid-hash.hip b/clang/test/Driver/hip-cuid-hash.hip index 103a1cbf26d50..a4167d664537e 100644 --- a/clang/test/Driver/hip-cuid-hash.hip +++ b/clang/test/Driver/hip-cuid-hash.hip @@ -1,13 +1,20 @@ // Check CUID generated by hash. // The same CUID is generated for the same file with the same options. +// This test requires relative paths for input files. Since the test may be +// done out of source tree, create the local directory structure and copy the +// input file from the source tree into that directory. +// RUN: mkdir -p %t/Inputs/hip_multiple_inputs +// RUN: cp %S/Inputs/hip_multiple_inputs/a.cu %t/Inputs/hip_multiple_inputs/a.cu +// RUN: cd %t + // RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \ // RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \ -// RUN: %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1 +// RUN: Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1 // RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \ // RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \ -// RUN: %S/Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1 +// RUN: Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1 // RUN: FileCheck %s -check-prefixes=SAME -input-file %t.out @@ -16,11 +23,11 @@ // RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu -DX=1 --no-offload-new-driver \ // RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \ -// RUN: %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1 +// RUN: Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1 // RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu -DX=2 --no-offload-new-driver \ // RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \ -// RUN: %S/Inputs/../Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1 +// RUN: Inputs/../Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1 // RUN: FileCheck %s -check-prefixes=DIFF -input-file %t.out _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits