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(
724
724
std::optional<int > ObjectStoreCachingOutputs::replayCachedResult (
725
725
const llvm::cas::CASID &ResultCacheKey, llvm::cas::ObjectRef ResultID,
726
726
bool JustComputedResult) {
727
- if (JustComputedResult && !ComputedJobNeedsReplay )
727
+ if (JustComputedResult && !WriteOutputAsCASID )
728
728
return std::nullopt;
729
729
730
730
// FIXME: Stop calling report_fatal_error().
@@ -745,10 +745,7 @@ std::optional<int> ObjectStoreCachingOutputs::replayCachedResult(
745
745
Expected<std::optional<int >> ObjectStoreCachingOutputs::replayCachedResult (
746
746
const llvm::cas::CASID &ResultCacheKey,
747
747
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)
752
749
return std::nullopt;
753
750
754
751
llvm::cas::ObjectStore &CAS = Result.getCAS ();
Original file line number Diff line number Diff line change 1
1
// RUN: rm -rf %t && mkdir -p %t
2
2
// RUN: llvm-cas --cas %t/cas --ingest %s > %t/casid
3
3
//
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 \
5
5
// RUN: -fcas-path %t/cas -fcas-fs @%t/casid -fcache-compile-job \
6
6
// RUN: -Rcompile-job-cache %s -emit-obj -o %t/output.o \
7
7
// RUN: -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=lldb \
11
11
// RUN: ls %t/output.o && rm %t/output.o
12
12
// RUN: ls %t/deps.d && mv %t/deps.d %t/deps.d.orig
13
13
//
14
- // RUN: CLANG_CAS_BACKEND_SAVE_CASID_FILE=1 %clang -cc1 \
14
+ // RUN: %clang -cc1 -fcas-emit-casid-file \
15
15
// RUN: -triple x86_64-apple-macos11 -fcas-backend \
16
16
// RUN: -fcas-path %t/cas -fcas-fs @%t/casid -fcache-compile-job \
17
17
// 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 @@ -76,6 +76,7 @@ uint64_t MachOCASWriter::writeObject(MCAssembler &Asm) {
76
76
inconvertibleErrorCode (),
77
77
" CASBackend output round-trip verification error" );
78
78
79
+ OS << ObjectBuffer;
79
80
return Error::success ();
80
81
};
81
82
@@ -85,11 +86,6 @@ uint64_t MachOCASWriter::writeObject(MCAssembler &Asm) {
85
86
// If there is a callback, then just hand off the result through callback.
86
87
if (ResultCallBack) {
87
88
cantFail ((*ResultCallBack)(CASObj.getID ()));
88
- if (Mode == CASBackendMode::Verify) {
89
- if (auto E = VerifyObject ())
90
- report_fatal_error (std::move (E));
91
- }
92
- return 0 ;
93
89
}
94
90
95
91
switch (Mode) {
@@ -103,17 +99,8 @@ uint64_t MachOCASWriter::writeObject(MCAssembler &Asm) {
103
99
break ;
104
100
}
105
101
case CASBackendMode::Verify: {
106
- SmallString<512 > ObjectBuffer;
107
- raw_svector_ostream ObjectOS (ObjectBuffer);
108
- auto E = SerializeObjectFile (CASObj, CAS, ObjectOS);
109
- if (E)
102
+ if (auto E = VerifyObject ())
110
103
report_fatal_error (std::move (E));
111
-
112
- if (!ObjectBuffer.equals (InternalBuffer))
113
- report_fatal_error (" CASBackend output round-trip verification error" );
114
-
115
- OS << ObjectBuffer;
116
- break ;
117
104
}
118
105
}
119
106
You can’t perform that action at this time.
0 commit comments