Skip to content

Commit 5462890

Browse files
Merge pull request #7692 from rastogishubham/FixMCCASReplayStable
Fix mccas replay stable
2 parents 9a3cb68 + 767c9a5 commit 5462890

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

clang/lib/Frontend/CompileJobCache.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,10 @@ std::optional<int> ObjectStoreCachingOutputs::replayCachedResult(
684684
Expected<std::optional<int>> ObjectStoreCachingOutputs::replayCachedResult(
685685
const llvm::cas::CASID &ResultCacheKey,
686686
clang::cas::CompileJobCacheResult &Result, bool JustComputedResult) {
687-
if (JustComputedResult)
687+
// FIXME: The correct fix for MCCAS replay is that you have an official CASID
688+
// file output going all the way down into ObjectWriter, we can remove this
689+
// callback and special case.
690+
if (JustComputedResult && !ComputedJobNeedsReplay)
688691
return std::nullopt;
689692

690693
llvm::cas::ObjectStore &CAS = Result.getCAS();

clang/test/CAS/mccas-replay-test.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// RUN: rm -rf %t && mkdir -p %t
2+
// RUN: export LLVM_CACHE_CAS_PATH=%t/cas && %clang-cache \
3+
// RUN: %clang -target arm64-apple-macosx12.0.0 -c -Xclang -fcas-backend -Rcompile-job-cache %s -o %t/tmp.o -g 2>&1 | FileCheck %s -check-prefix=CACHE-MISS
4+
// CACHE-MISS: remark: compile job cache miss
5+
6+
// RUN: llvm-objdump -h %t/tmp.o | FileCheck %s -check-prefix=CHECK-OBJDUMP
7+
8+
// RUN: export LLVM_CACHE_CAS_PATH=%t/cas && %clang-cache \
9+
// RUN: %clang -target arm64-apple-macosx12.0.0 -c -Xclang -fcas-backend -Rcompile-job-cache %s -o %t/tmp.o -g 2>&1 | FileCheck %s -check-prefix=CACHE-HIT
10+
// CACHE-HIT: remark: compile job cache hit
11+
12+
// RUN: llvm-objdump -h %t/tmp.o 2>&1 | FileCheck %s -check-prefix=CHECK-OBJDUMP
13+
14+
// CHECK-OBJDUMP: Sections:
15+
// CHECK-OBJDUMP-NEXT: Idx Name Size VMA Type
16+
// CHECK-OBJDUMP-NEXT: 0 __text {{[0-9a-f]+}} {{[0-9a-f]+}} TEXT
17+
// CHECK-OBJDUMP-NEXT: 1 __debug_abbrev {{[0-9a-f]+}} {{[0-9a-f]+}} DATA, DEBUG
18+
// CHECK-OBJDUMP-NEXT: 2 __debug_info {{[0-9a-f]+}} {{[0-9a-f]+}} DATA, DEBUG
19+
// CHECK-OBJDUMP-NEXT: 3 __debug_str {{[0-9a-f]+}} {{[0-9a-f]+}} DATA, DEBUG
20+
// CHECK-OBJDUMP-NEXT: 4 __apple_names {{[0-9a-f]+}} {{[0-9a-f]+}} DATA, DEBUG
21+
// CHECK-OBJDUMP-NEXT: 5 __apple_objc {{[0-9a-f]+}} {{[0-9a-f]+}} DATA, DEBUG
22+
// CHECK-OBJDUMP-NEXT: 6 __apple_namespac {{[0-9a-f]+}} {{[0-9a-f]+}} DATA, DEBUG
23+
// CHECK-OBJDUMP-NEXT: 7 __apple_types {{[0-9a-f]+}} {{[0-9a-f]+}} DATA, DEBUG
24+
// CHECK-OBJDUMP-NEXT: 8 __compact_unwind {{[0-9a-f]+}} {{[0-9a-f]+}} DATA
25+
// CHECK-OBJDUMP-NEXT: 9 __debug_line {{[0-9a-f]+}} {{[0-9a-f]+}} DATA, DEBUG
26+
27+
// REQUIRES: aarch64-registered-target
28+
29+
int foo() {
30+
return 1;
31+
}

0 commit comments

Comments
 (0)