File tree Expand file tree Collapse file tree 4 files changed +31
-22
lines changed Expand file tree Collapse file tree 4 files changed +31
-22
lines changed Original file line number Diff line number Diff line change @@ -724,7 +724,7 @@ Error ObjectStoreCachingOutputs::finishComputedResult(
724724std::optional<int > ObjectStoreCachingOutputs::replayCachedResult (
725725 const llvm::cas::CASID &ResultCacheKey, llvm::cas::ObjectRef ResultID,
726726 bool JustComputedResult) {
727- if (JustComputedResult && !ComputedJobNeedsReplay )
727+ if (JustComputedResult && !WriteOutputAsCASID )
728728 return std::nullopt ;
729729
730730 // FIXME: Stop calling report_fatal_error().
@@ -745,10 +745,7 @@ std::optional<int> ObjectStoreCachingOutputs::replayCachedResult(
745745Expected<std::optional<int >> ObjectStoreCachingOutputs::replayCachedResult (
746746 const llvm::cas::CASID &ResultCacheKey,
747747 clang::cas::CompileJobCacheResult &Result, bool JustComputedResult) {
748- // FIXME: The correct fix for MCCAS replay is that you have an official CASID
749- // file output going all the way down into ObjectWriter, we can remove this
750- // callback and special case.
751- if (JustComputedResult && !ComputedJobNeedsReplay)
748+ if (JustComputedResult && !WriteOutputAsCASID)
752749 return std::nullopt ;
753750
754751 llvm::cas::ObjectStore &CAS = Result.getCAS ();
Original file line number Diff line number Diff line change 11// RUN: rm -rf %t && mkdir -p %t
22// RUN: llvm-cas --cas %t/cas --ingest %s > %t/casid
33//
4- // RUN: %clang -cc1 -triple x86_64-apple-macos11 -fcas-backend \
4+ // RUN: %clang -cc1 -fcas-emit-casid-file - triple x86_64-apple-macos11 -fcas-backend \
55// RUN: -fcas-path %t/cas -fcas-fs @%t/casid -fcache-compile-job \
66// RUN: -Rcompile-job-cache %s -emit-obj -o %t/output.o \
77// RUN: -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb \
1111// RUN: ls %t/output.o && rm %t/output.o
1212// RUN: ls %t/deps.d && mv %t/deps.d %t/deps.d.orig
1313//
14- // RUN: CLANG_CAS_BACKEND_SAVE_CASID_FILE=1 %clang -cc1 \
14+ // RUN: %clang -cc1 -fcas-emit-casid-file \
1515// RUN: -triple x86_64-apple-macos11 -fcas-backend \
1616// RUN: -fcas-path %t/cas -fcas-fs @%t/casid -fcache-compile-job \
1717// RUN: -Rcompile-job-cache %s -emit-obj -o %t/output.o \
Original file line number Diff line number Diff line change 1+ // RUN: rm -rf %t && mkdir -p %t
2+
3+ // Check if -fcasid-output works on a cache miss with file based caching
4+ // RUN: env LLVM_CACHE_CAS_PATH=%t/cas CLANG_CACHE_DISABLE_MCCAS=1 %clang-cache %clang -target x86_64-apple-macos11 -Xclang -fcasid-output -g -c %s -o %t/test.o
5+ // RUN: cat %t/test.o | FileCheck %s
6+ // RUN: rm -rf %t/test.o
7+ // Check if -fcasid-output works on a cache hit with file based caching
8+ // RUN: env LLVM_CACHE_CAS_PATH=%t/cas CLANG_CACHE_DISABLE_MCCAS=1 %clang-cache %clang -target x86_64-apple-macos11 -Xclang -fcasid-output -g -c %s -o %t/test.o
9+ // RUN: cat %t/test.o | FileCheck %s
10+ // RUN: rm -rf %t/test.o
11+ // RUN: rm -rf %t/cas
12+
13+ // Check if -fcasid-output works on a cache miss with MCCAS
14+ // RUN: env LLVM_CACHE_CAS_PATH=%t/cas %clang-cache %clang -target x86_64-apple-macos11 -Xclang -fcasid-output -g -c %s -o %t/test.o
15+ // RUN: cat %t/test.o | FileCheck %s
16+ // RUN: rm -rf %t/test.o
17+
18+ // Check if -fcasid-output works on a cache hit with MCCAS
19+ // RUN: env LLVM_CACHE_CAS_PATH=%t/cas %clang-cache %clang -target x86_64-apple-macos11 -Xclang -fcasid-output -g -c %s -o %t/test.o
20+ // RUN: cat %t/test.o | FileCheck %s
21+
22+ // CHECK: llvmcas://{{[a-f0-9]+}}
23+
24+
25+ void foo () {}
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ uint64_t MachOCASWriter::writeObject(MCAssembler &Asm,
7878 inconvertibleErrorCode (),
7979 " CASBackend output round-trip verification error" );
8080
81+ OS << ObjectBuffer;
8182 return Error::success ();
8283 };
8384
@@ -87,11 +88,6 @@ uint64_t MachOCASWriter::writeObject(MCAssembler &Asm,
8788 // If there is a callback, then just hand off the result through callback.
8889 if (ResultCallBack) {
8990 cantFail ((*ResultCallBack)(CASObj.getID ()));
90- if (Mode == CASBackendMode::Verify) {
91- if (auto E = VerifyObject ())
92- report_fatal_error (std::move (E));
93- }
94- return 0 ;
9591 }
9692
9793 switch (Mode) {
@@ -105,17 +101,8 @@ uint64_t MachOCASWriter::writeObject(MCAssembler &Asm,
105101 break ;
106102 }
107103 case CASBackendMode::Verify: {
108- SmallString<512 > ObjectBuffer;
109- raw_svector_ostream ObjectOS (ObjectBuffer);
110- auto E = SerializeObjectFile (CASObj, CAS, ObjectOS);
111- if (E)
104+ if (auto E = VerifyObject ())
112105 report_fatal_error (std::move (E));
113-
114- if (!ObjectBuffer.equals (InternalBuffer))
115- report_fatal_error (" CASBackend output round-trip verification error" );
116-
117- OS << ObjectBuffer;
118- break ;
119106 }
120107 }
121108
You can’t perform that action at this time.
0 commit comments