Skip to content

Commit 5fe838d

Browse files
committed
Reland "[HIP] Use original file path for CUID" (#108771)
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.
1 parent 4f40b07 commit 5fe838d

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,7 @@ std::string CUIDOptions::getCUID(StringRef InputFile,
226226
else if (UseCUID == Kind::Hash) {
227227
llvm::MD5 Hasher;
228228
llvm::MD5::MD5Result Hash;
229-
SmallString<256> RealPath;
230-
llvm::sys::fs::real_path(InputFile, RealPath,
231-
/*expand_tilde=*/true);
232-
Hasher.update(RealPath);
229+
Hasher.update(IA->getInputArg().getValue());
233230
for (auto *A : Args) {
234231
if (A->getOption().matches(options::OPT_INPUT))
235232
continue;

clang/test/Driver/hip-cuid-hash.hip

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
// Check CUID generated by hash.
22
// The same CUID is generated for the same file with the same options.
33

4+
// RUN: cd %S
5+
46
// RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
57
// RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
6-
// RUN: %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
8+
// RUN: Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
79

810
// RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
911
// RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
10-
// RUN: %S/Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1
12+
// RUN: Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1
1113

1214
// RUN: FileCheck %s -check-prefixes=SAME -input-file %t.out
1315

@@ -16,11 +18,11 @@
1618

1719
// RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu -DX=1 --no-offload-new-driver \
1820
// RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
19-
// RUN: %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
21+
// RUN: Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
2022

2123
// RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu -DX=2 --no-offload-new-driver \
2224
// RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
23-
// RUN: %S/Inputs/../Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1
25+
// RUN: Inputs/../Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1
2426

2527
// RUN: FileCheck %s -check-prefixes=DIFF -input-file %t.out
2628

0 commit comments

Comments
 (0)