Skip to content

Commit f5d4293

Browse files
authored
Revert "[HIP] Use original file path for CUID (#107734)"
This reverts commit 9fc789d.
1 parent 43f044b commit f5d4293

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3034,7 +3034,10 @@ class OffloadingActionBuilder final {
30343034
else if (UseCUID == CUID_Hash) {
30353035
llvm::MD5 Hasher;
30363036
llvm::MD5::MD5Result Hash;
3037-
Hasher.update(IA->getInputArg().getValue());
3037+
SmallString<256> RealPath;
3038+
llvm::sys::fs::real_path(IA->getInputArg().getValue(), RealPath,
3039+
/*expand_tilde=*/true);
3040+
Hasher.update(RealPath);
30383041
for (auto *A : Args) {
30393042
if (A->getOption().matches(options::OPT_INPUT))
30403043
continue;

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
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-
64
// RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
75
// RUN: --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
8-
// RUN: Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
6+
// RUN: %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
97

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

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

@@ -18,15 +16,15 @@
1816

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

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

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

29-
// SAME: "-cc1"{{.*}} "-target-cpu" "gfx906" {{.*}}"-cuid=[[CUID:3c08c1ef86ef439d]]"
27+
// SAME: "-cc1"{{.*}} "-target-cpu" "gfx906" {{.*}}"-cuid=[[CUID:[0-9a-f]+]]"
3028
// SAME: "-cc1"{{.*}} "-target-cpu" "gfx906" {{.*}}"-cuid=[[CUID]]"
3129

3230
// DIFF: "-cc1"{{.*}} "-target-cpu" "gfx906" {{.*}}"-cuid=[[CUID:[0-9a-f]+]]"

0 commit comments

Comments
 (0)