Skip to content

Commit 91482c1

Browse files
Merge pull request #7566 from rastogishubham/LLVMCASStable
cherry-pick llvm-cas-object-format to stable
2 parents e7ba20f + 04a77c3 commit 91482c1

24 files changed

+291
-49
lines changed

clang/test/CAS/cached-diags-scratch-space.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: rm -rf %t && mkdir -p %t
2-
// RUN: llvm-cas --cas %t/cas --ingest --data %s > %t/casid
2+
// RUN: llvm-cas --cas %t/cas --ingest %s > %t/casid
33

44
// Check that this doesn't crash and provides proper round-tripping.
55

clang/test/CAS/cas-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: rm -rf %t && mkdir -p %t
2-
// RUN: llvm-cas --cas %t/cas --ingest --data %s > %t/casid
2+
// RUN: llvm-cas --cas %t/cas --ingest %s > %t/casid
33
//
44
// RUN: %clang -cc1 -triple x86_64-apple-macos11 -fcas-backend \
55
// RUN: -fcas-path %t/cas -fcas-fs @%t/casid -fcache-compile-job \

clang/test/CAS/fcache-compile-job-dependency-file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: rm -rf %t && mkdir -p %t
22
// RUN: split-file %s %t/src
3-
// RUN: llvm-cas --cas %t/cas --ingest --data %t/src > %t/casid
3+
// RUN: llvm-cas --cas %t/cas --ingest %t/src > %t/casid
44
//
55
// RUN: %clang -cc1 -triple x86_64-apple-macos11 \
66
// RUN: -fcas-path %t/cas -fcas-fs @%t/casid -fcache-compile-job \
@@ -58,7 +58,7 @@
5858
// DEPS_SYS: sys.h
5959

6060
// Using another cas path to avoid reusing artifacts.
61-
// RUN: llvm-cas --cas %t/cas2 --ingest --data %t/src
61+
// RUN: llvm-cas --cas %t/cas2 --ingest %t/src
6262

6363
// RUN: %clang -cc1 -triple x86_64-apple-macos11 \
6464
// RUN: -fcas-path %t/cas2 -fcas-fs @%t/casid -fcache-compile-job \

clang/test/CAS/fcache-compile-job-serialized-diagnostics.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: rm -rf %t && mkdir -p %t
2-
// RUN: llvm-cas --cas %t/cas --ingest --data %s > %t/casid
2+
// RUN: llvm-cas --cas %t/cas --ingest %s > %t/casid
33

44
// RUN: %clang -cc1 -triple x86_64-apple-macos11 -fcas-path %t/cas \
55
// RUN: -fcas-fs @%t/casid -fcache-compile-job \

clang/test/CAS/fcache-compile-job.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: rm -rf %t && mkdir -p %t
2-
// RUN: llvm-cas --cas %t/cas --ingest --data %s > %t/casid
2+
// RUN: llvm-cas --cas %t/cas --ingest %s > %t/casid
33
//
44
// RUN: %clang -cc1 -triple x86_64-apple-macos11 \
55
// RUN: -fcas-path %t/cas -fcas-fs @%t/casid -fcache-compile-job \
@@ -35,7 +35,7 @@
3535

3636
// Check for a handling error if the CAS is removed but not action cache.
3737
// First need to ingest the input file so the compile cache can be constructed.
38-
// RUN: llvm-cas --ingest --cas %t/cas.new --data %s
38+
// RUN: llvm-cas --ingest --cas %t/cas.new %s
3939
// Add the 'key => result' association we got earlier.
4040
// RUN: llvm-cas --cas %t/cas.new --put-cache-key @%t/cache-key @%t/cache-result
4141
// RUN: %clang -cc1 -triple x86_64-apple-macos11 \

clang/test/CAS/fmodule-file-cache-key-errors.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// RUN: rm -rf %t %t.cas %t.cas_2
77
// RUN: split-file %s %t
88

9-
// RUN: llvm-cas --cas %t.cas --ingest --data %t > %t/casid
9+
// RUN: llvm-cas --cas %t.cas --ingest %t > %t/casid
1010

1111
// RUN: not %clang_cc1 -triple x86_64-apple-macos11 \
1212
// RUN: -fmodules -fno-implicit-modules \

clang/test/CAS/fmodule-file-cache-key-lazy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// RUN: rm -rf %t %t.cas
77
// RUN: split-file %s %t
88

9-
// RUN: llvm-cas --cas %t.cas --ingest --data %t > %t/casid
9+
// RUN: llvm-cas --cas %t.cas --ingest %t > %t/casid
1010

1111
// == Build B
1212

clang/test/CAS/fmodule-file-cache-key-with-pch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// RUN: rm -rf %t %t.cas
88
// RUN: split-file %s %t
99

10-
// RUN: llvm-cas --cas %t.cas --ingest --data %t > %t/casid
10+
// RUN: llvm-cas --cas %t.cas --ingest %t > %t/casid
1111

1212
// == Build B
1313

@@ -63,7 +63,7 @@
6363
// == Clear pcms to ensure they load from cache, and re-ingest with pch
6464

6565
// RUN: rm %t/*.pcm
66-
// RUN: llvm-cas --cas %t.cas --ingest --data %t > %t/casid
66+
// RUN: llvm-cas --cas %t.cas --ingest %t > %t/casid
6767
// RUN: rm %t/*.pch
6868

6969
// == Build tu

clang/test/CAS/fmodule-file-cache-key.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// RUN: rm -rf %t %t.cas
77
// RUN: split-file %s %t
88

9-
// RUN: llvm-cas --cas %t.cas --ingest --data %t > %t/casid
9+
// RUN: llvm-cas --cas %t.cas --ingest %t > %t/casid
1010

1111
// == Build B
1212

clang/test/CAS/output-path-create-directories.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: rm -rf %t %t.cas
22
// RUN: split-file %s %t
3-
// RUN: llvm-cas --cas %t.cas --ingest --data %t > %t/casid
3+
// RUN: llvm-cas --cas %t.cas --ingest %t > %t/casid
44

55
// RUN: %clang_cc1 -triple x86_64-apple-macos11 \
66
// RUN: -fmodules -fmodule-name=Mod -fno-implicit-modules \

clang/test/CAS/output-path-error.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// REQUIRES: shell
44

55
// RUN: rm -rf %t && mkdir -p %t
6-
// RUN: llvm-cas --cas %t/cas --ingest --data %s > %t/casid
6+
// RUN: llvm-cas --cas %t/cas --ingest %s > %t/casid
77

88
// RUN: %clang -cc1 -triple x86_64-apple-macos11 \
99
// RUN: -fcas-path %t/cas -fcas-fs @%t/casid -fcache-compile-job \

clang/test/CAS/print-compile-job-cache-key.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// REQUIRES: shell
22

33
// RUN: rm -rf %t && mkdir -p %t
4-
// RUN: llvm-cas --cas %t/cas --ingest --data %s > %t/casid
4+
// RUN: llvm-cas --cas %t/cas --ingest %s > %t/casid
55
//
66
// RUN: %clang -cc1 -triple x86_64-apple-macos11 \
77
// RUN: -fcas-path %t/cas -fcas-fs @%t/casid -fcache-compile-job \
@@ -60,7 +60,7 @@
6060
// RUN: clang-cas-test -print-include-tree -cas %t/cas @%t/include-tree-id | FileCheck %s -check-prefix=INCLUDE_TREE -DSRC_FILE=%s
6161

6262
// Print key from plugin CAS.
63-
// RUN: llvm-cas --cas plugin://%llvmshlibdir/libCASPluginTest%pluginext?ondisk-path=%t/cas-plugin --ingest --data %s > %t/casid-plugin
63+
// RUN: llvm-cas --cas plugin://%llvmshlibdir/libCASPluginTest%pluginext?ondisk-path=%t/cas-plugin --ingest %s > %t/casid-plugin
6464
// RUN: %clang -cc1 -triple x86_64-apple-macos11 \
6565
// RUN: -fcas-path %t/cas-plugin -fcas-fs @%t/casid-plugin -fcache-compile-job \
6666
// RUN: -fcas-plugin-path %llvmshlibdir/libCASPluginTest%pluginext \

clang/test/CAS/test-for-deterministic-module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// RUN: rm -rf %t
44
// RUN: split-file %s %t
5-
// RUN: llvm-cas --cas %t.cas --ingest --data %t > %t/casid
5+
// RUN: llvm-cas --cas %t.cas --ingest %t > %t/casid
66
//
77
// RUN: not %clang_cc1 -triple x86_64-apple-macos11 \
88
// RUN: -fmodules -fmodule-name=A -fno-implicit-modules \

llvm/test/CAS/Inputs/cas-creation-stress-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ for c in $(seq 1 $NUM_REPEAT); do
1616

1717
pids=""
1818
for x in $(seq 1 10); do
19-
$LLVM_CAS_TOOL --ingest --data $INGEST_FILE --cas $CAS_PATH &
19+
$LLVM_CAS_TOOL --ingest $INGEST_FILE --cas $CAS_PATH &
2020
pids="$pids $!"
2121
done
2222

llvm/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ set(LLVM_TEST_DEPENDS
7575
llvm-bitcode-strip
7676
llvm-c-test
7777
llvm-cas
78+
llvm-cas-object-format
7879
llvm-cas-dump
7980
llvm-cat
8081
llvm-cfi-verify
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// REQUIRES: x86-registered-target
2+
// RUN: rm -rf %t && mkdir -p %t
3+
// RUN: llvm-mc -cas %t/cas -cas-backend -mccas-casid -triple x86_64-apple-darwin10 %s -filetype=obj -o %t/test.o
4+
// RUN: cd %t && llvm-cas --ingest --cas %t/cas --casid-file %t/test.o > %t/output.casid
5+
// RUN: llvm-cas-object-format --cas %t/cas --materialize-objects --output-prefix %t/output @%t/output.casid
6+
7+
.text
8+
_foo:
9+
ret
10+
11+
_baz:
12+
call _foo
13+
ret
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
; REQUIRES: aarch64-registered-target
2+
; RUN: rm -rf %t && mkdir -p %t
3+
; RUN: split-file %s %t
4+
5+
; RUN: llc --filetype=obj %t/a.ll -o %t/a.o
6+
; RUN: llc --filetype=obj %t/b.ll -o %t/b.o
7+
; RUN: llvm-cas --ingest %t/a.o %t/b.o --cas %t/cas > %t/just-blobs.id
8+
; RUN: llvm-cas-dump --cas %t/cas --object-stats - @%t/just-blobs.id | FileCheck %s --check-prefix=JUST-BLOBS
9+
10+
; JUST-BLOBS: Kind Count Parents Children Data (B) Cost (B)
11+
; JUST-BLOBS-NEXT: ==== ===== ======= ======== ======== ========
12+
; JUST-BLOBS-NEXT: builtin:node
13+
; JUST-BLOBS-NEXT: builtin:tree
14+
; JUST-BLOBS-NEXT: TOTAL
15+
16+
; RUN: llc --filetype=obj --cas-backend --cas=%t/cas --mccas-casid --mtriple=arm64-apple-darwin %t/a.ll -o %t/a.id
17+
; RUN: llc --filetype=obj --cas-backend --cas=%t/cas --mccas-casid --mtriple=arm64-apple-darwin %t/b.ll -o %t/b.id
18+
; RUN: llvm-cas --ingest --casid-file %t/a.id %t/b.id --cas %t/cas > %t/casid-file.id
19+
; RUN: llvm-cas-dump --cas %t/cas --object-stats - @%t/casid-file.id | FileCheck %s --check-prefix=CASID-FILE
20+
21+
; CASID-FILE: Kind Count Parents Children Data (B) Cost (B)
22+
; CASID-FILE-NEXT: ==== ===== ======= ======== ======== ========
23+
; CASID-FILE-NEXT: builtin:node
24+
; CASID-FILE-NEXT: builtin:tree
25+
; CASID-FILE-NEXT: mc:addends
26+
; CASID-FILE-NEXT: mc:assembler
27+
; CASID-FILE-NEXT: mc:atom
28+
; CASID-FILE-NEXT: mc:cstring
29+
; CASID-FILE-NEXT: mc:data
30+
; CASID-FILE-NEXT: mc:data_in_code
31+
; CASID-FILE-NEXT: mc:group
32+
; CASID-FILE-NEXT: mc:header
33+
; CASID-FILE-NEXT: mc:padding
34+
; CASID-FILE-NEXT: mc:section
35+
; CASID-FILE-NEXT: mc:symbol_table
36+
; CASID-FILE-NEXT: TOTAL
37+
38+
;--- a.ll
39+
; ModuleID = '/tmp/a.cpp'
40+
source_filename = "/tmp/a.cpp"
41+
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
42+
target triple = "arm64-apple-macosx14.0.0"
43+
44+
; Function Attrs: mustprogress noinline nounwind optnone ssp uwtable(sync)
45+
define noundef i32 @_Z3foov() #0 {
46+
entry:
47+
ret i32 1
48+
}
49+
50+
attributes #0 = { mustprogress noinline nounwind optnone ssp uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+sha3,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
51+
52+
!llvm.module.flags = !{!0, !1, !2, !3}
53+
!llvm.ident = !{!4}
54+
55+
!0 = !{i32 1, !"wchar_size", i32 4}
56+
!1 = !{i32 8, !"PIC Level", i32 2}
57+
!2 = !{i32 7, !"uwtable", i32 1}
58+
!3 = !{i32 7, !"frame-pointer", i32 1}
59+
!4 = !{!"clang version 18.0.0 ([email protected]:apple/llvm-project.git d3fd8ffd82db3374b06bfd2e30a85cf05916f565)"}
60+
61+
;--- b.ll
62+
; ModuleID = '/tmp/b.cpp'
63+
source_filename = "/tmp/b.cpp"
64+
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
65+
target triple = "arm64-apple-macosx14.0.0"
66+
67+
; Function Attrs: mustprogress noinline nounwind optnone ssp uwtable(sync)
68+
define noundef i32 @_Z3barv() #0 {
69+
entry:
70+
ret i32 1
71+
}
72+
73+
attributes #0 = { mustprogress noinline nounwind optnone ssp uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+sha3,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
74+
75+
!llvm.module.flags = !{!0, !1, !2, !3}
76+
!llvm.ident = !{!4}
77+
78+
!0 = !{i32 1, !"wchar_size", i32 4}
79+
!1 = !{i32 8, !"PIC Level", i32 2}
80+
!2 = !{i32 7, !"uwtable", i32 1}
81+
!3 = !{i32 7, !"frame-pointer", i32 1}
82+
!4 = !{!"clang version 18.0.0 ([email protected]:apple/llvm-project.git d3fd8ffd82db3374b06bfd2e30a85cf05916f565)"}

llvm/test/tools/llvm-cas/ingest-remap.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
RUN: rm -rf %t && mkdir -p %t
22

3-
RUN: llvm-cas --cas %t/cas --ingest --prefix-map %S/Inputs=/^input --data %S/Inputs > %t/cas.id
3+
RUN: llvm-cas --cas %t/cas --ingest --prefix-map %S/Inputs=/^input %S/Inputs > %t/cas.id
44
RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/cas.id | FileCheck %s
55

66
CHECK: syml

llvm/test/tools/llvm-cas/ingest.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
RUN: rm -rf %t
22
RUN: mkdir %t
33

4-
RUN: llvm-cas --cas %t/cas --ingest --data %S/Inputs > %t/cas.id
4+
RUN: llvm-cas --cas %t/cas --ingest %S/Inputs > %t/cas.id
55
RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/cas.id | FileCheck %s
66

77
// Using the plugin.
8-
RUN: llvm-cas --cas plugin://%llvmshlibdir/libCASPluginTest%pluginext?ondisk-path=%t/cas-plugin --ingest --data %S/Inputs > %t/cas-plugin.id
8+
RUN: llvm-cas --cas plugin://%llvmshlibdir/libCASPluginTest%pluginext?ondisk-path=%t/cas-plugin --ingest %S/Inputs > %t/cas-plugin.id
99
RUN: llvm-cas --cas plugin://%llvmshlibdir/libCASPluginTest%pluginext?ondisk-path=%t/cas-plugin --ls-tree-recursive @%t/cas-plugin.id | FileCheck %s
1010
RUN: llvm-cas --cas %t/cas-plugin -fcas-plugin-path %llvmshlibdir/libCASPluginTest%pluginext --ls-tree-recursive @%t/cas-plugin.id | FileCheck %s
1111

llvm/test/tools/llvm-cas/print-id.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
RUN: rm -rf %t
22
RUN: mkdir %t
33

4-
RUN: llvm-cas --cas %t/cas --ingest --data %S/Inputs > %t/id
4+
RUN: llvm-cas --cas %t/cas --ingest %S/Inputs > %t/id
55

66
# Confirm that the ID has the right prefix, is well-formed, and that there's
77
# nothing else on the line.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set(LLVM_LINK_COMPONENTS
2+
Support
3+
CAS
4+
RemoteCachingService
5+
MCCAS
6+
)
7+
8+
add_llvm_tool(llvm-cas-object-format
9+
llvm-cas-object-format.cpp
10+
)

0 commit comments

Comments
 (0)