-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Add replay support for MCCAS in Swift. #74202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // REQUIRES: OS=macosx | ||
| // RUN: %empty-directory(%t) | ||
| // RUN: split-file %s %t | ||
|
|
||
| // RUN: %target-swift-frontend -scan-dependencies -module-name Test -O -module-cache-path %t/clang-module-cache \ | ||
| // RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib \ | ||
| // RUN: %t/test.swift -I %t -o %t/deps.json -cache-compile-job -cas-backend -cas-backend-mode=verify -cas-path %t/cas | ||
|
|
||
| /// Check clang module | ||
| // RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:Dummy > %t/dummy.cmd | ||
| // RUN: %swift_frontend_plain @%t/dummy.cmd -Rcache-compile-job 2>&1 | %FileCheck --check-prefix=CACHE-MISS %s | ||
| // RUN: %swift_frontend_plain @%t/dummy.cmd -Rcache-compile-job 2>&1 | %FileCheck --check-prefix=CACHE-HIT-CLANG %s | ||
|
|
||
| // RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json | ||
| // RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid | ||
|
|
||
| // RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd | ||
| // RUN: echo "\"-disable-implicit-string-processing-module-import\"" >> %t/MyApp.cmd | ||
| // RUN: echo "\"-disable-implicit-concurrency-module-import\"" >> %t/MyApp.cmd | ||
| // RUN: echo "\"-disable-implicit-swift-modules\"" >> %t/MyApp.cmd | ||
| // RUN: echo "\"-parse-stdlib\"" >> %t/MyApp.cmd | ||
| // RUN: echo "\"-explicit-swift-module-map-file\"" >> %t/MyApp.cmd | ||
| // RUN: echo "\"@%t/map.casid\"" >> %t/MyApp.cmd | ||
|
|
||
| /// Run the command first time, expect cache miss. | ||
| // RUN: %target-swift-frontend -cache-compile-job -cas-backend -cas-backend-mode=verify -Rcache-compile-job %t/test.swift -O -emit-module -emit-module-path %t/Test.swiftmodule -c -emit-dependencies \ | ||
| // RUN: -module-name Test -o %t/test.o -cas-path %t/cas @%t/MyApp.cmd 2>&1 | %FileCheck --check-prefix=CACHE-MISS %s | ||
| // RUN: test -f %t/test.o | ||
| // RUN: test -f %t/test.d | ||
| // RUN: test -f %t/Test.swiftmodule | ||
|
|
||
| /// Expect cache hit for second time. | ||
| // RUN: %target-swift-frontend -cache-compile-job -cas-backend -cas-backend-mode=verify -Rcache-compile-job %t/test.swift -O -emit-module -emit-module-path %t/Test.swiftmodule -c -emit-dependencies \ | ||
| // RUN: -module-name Test -o %t/test.o -cas-path %t/cas @%t/MyApp.cmd 2>&1 | %FileCheck --check-prefix=CACHE-HIT %s | ||
| // RUN: test -f %t/test.o | ||
| // RUN: test -f %t/test.d | ||
| // RUN: test -f %t/Test.swiftmodule | ||
|
|
||
| /// Expect cache miss a subset of outputs. | ||
| // RUN %target-swift-frontend -cache-compile-job -cas-backend -cas-backend-mode=verify -Rcache-compile-job %t/test.swift -O -emit-module -emit-module-path %t/Test.swiftmodule -c \ | ||
| // RUN -module-name Test -o %t/test.o -cas-path %t/cas @%t/MyApp.cmd 2>&1 | %FileCheck --check-prefix=CACHE-MISS %s | ||
|
|
||
| /// Cache hit for retry. | ||
| // RUN %target-swift-frontend -cache-compile-job -cas-backend -cas-backend-mode=verify -Rcache-compile-job %t/test.swift -O -emit-module -emit-module-path %t/Test.swiftmodule -c \ | ||
| // RUN -module-name Test -o %t/test.o -cas-path %t/cas @%t/MyApp.cmd 2>&1 | %FileCheck --check-prefix=CACHE-HIT %s | ||
|
|
||
| /// Skip cache | ||
| // RUN %target-swift-frontend -cache-compile-job -cas-backend -cas-backend-mode=verify -Rcache-compile-job -cache-disable-replay %t/test.swift -O -emit-module -emit-module-path %t/Test.swiftmodule -c \ | ||
| // RUN -module-name Test -o %t/test.o -cas-path %t/cas @%t/MyApp.cmd 2>&1 | %FileCheck --allow-empty --check-prefix=SKIP-CACHE %s | ||
|
|
||
| // CACHE-MISS: remark: cache miss for input | ||
| // CACHE-HIT: remark: replay output file '<cached-diagnostics>': key 'llvmcas://{{.*}}' | ||
| // CACHE-HIT: remark: replay output file '{{.*}}{{/|\\}}test.o': key 'llvmcas://{{.*}}' | ||
| // CACHE-HIT: remark: replay output file '{{.*}}{{/|\\}}Test.swiftmodule': key 'llvmcas://{{.*}}' | ||
| // CACHE-HIT-CLANG: remark: replay output file '<cached-diagnostics>': key 'llvmcas://{{.*}}' | ||
| // CACHE-HIT-CLANG: remark: replay output file '{{.*}}{{/|\\}}Dummy-{{.*}}.pcm': key 'llvmcas://{{.*}}' | ||
| // SKIP-CACHE-NOT: remark: | ||
|
|
||
| //--- test.swift | ||
| import Dummy | ||
| func testFunc() {} | ||
|
|
||
| //--- module.modulemap | ||
| module Dummy { | ||
| umbrella header "Dummy.h" | ||
| } | ||
|
|
||
| //--- Dummy.h | ||
| void dummy(void); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // REQUIRES: OS=macosx | ||
rastogishubham marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // RUN: %empty-directory(%t) | ||
| // RUN: split-file %s %t | ||
|
|
||
| // RUN: %target-swift-frontend -scan-dependencies -module-name Test -O \ | ||
| // RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib \ | ||
| // RUN: %t/test.swift %t/foo.swift -o %t/deps.json -cache-compile-job -cas-backend -cas-backend-mode=verify -cas-path %t/cas | ||
|
|
||
| // RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json | ||
| // RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid | ||
|
|
||
| // RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd | ||
| // RUN: echo "\"-disable-implicit-string-processing-module-import\"" >> %t/MyApp.cmd | ||
| // RUN: echo "\"-disable-implicit-concurrency-module-import\"" >> %t/MyApp.cmd | ||
| // RUN: echo "\"-parse-stdlib\"" >> %t/MyApp.cmd | ||
|
|
||
| /// Test compile multiple inputs with batch mode. | ||
| // RUN: %target-swift-frontend -cache-compile-job -cas-backend -cas-backend-mode=verify -Rcache-compile-job %t/test.swift %t/foo.swift -emit-module -o %t/Test.swiftmodule \ | ||
| // RUN: -module-name Test -cas-path %t/cas @%t/MyApp.cmd 2>&1 | %FileCheck --check-prefix=CACHE-MISS %s | ||
| // RUN: %target-swift-frontend -cache-compile-job -cas-backend -cas-backend-mode=verify -Rcache-compile-job -primary-file %t/test.swift %t/foo.swift -c -o %t/test.o \ | ||
| // RUN: -module-name Test -cas-path %t/cas @%t/MyApp.cmd 2>&1 | %FileCheck --check-prefix=CACHE-MISS %s | ||
| // RUN: %target-swift-frontend -cache-compile-job -cas-backend -cas-backend-mode=verify -Rcache-compile-job %t/test.swift -primary-file %t/foo.swift -c -o %t/foo.o \ | ||
| // RUN: -module-name Test -cas-path %t/cas @%t/MyApp.cmd 2>&1 | %FileCheck --check-prefix=CACHE-MISS %s | ||
| // RUN: test -f %t/test.o | ||
| // RUN: test -f %t/foo.o | ||
| // RUN: test -f %t/Test.swiftmodule | ||
|
|
||
| /// Expect cache hit second time | ||
| // RUN: %target-swift-frontend -cache-compile-job -cas-backend -cas-backend-mode=verify -Rcache-compile-job %t/test.swift %t/foo.swift -emit-module -o %t/Test.swiftmodule \ | ||
| // RUN: -module-name Test -cas-path %t/cas @%t/MyApp.cmd 2>&1 | %FileCheck --check-prefix=CACHE-HIT %s | ||
| // RUN: %target-swift-frontend -cache-compile-job -cas-backend -cas-backend-mode=verify -Rcache-compile-job -primary-file %t/test.swift %t/foo.swift -c -o %t/test.o \ | ||
| // RUN: -module-name Test -cas-path %t/cas @%t/MyApp.cmd 2>&1 | %FileCheck --check-prefix=CACHE-HIT %s | ||
| // RUN: %target-swift-frontend -cache-compile-job -cas-backend -cas-backend-mode=verify -Rcache-compile-job %t/test.swift -primary-file %t/foo.swift -c -o %t/foo.o \ | ||
| // RUN: -module-name Test -cas-path %t/cas @%t/MyApp.cmd 2>&1 | %FileCheck --check-prefix=CACHE-HIT %s | ||
| // RUN: test -f %t/test.o | ||
| // RUN: test -f %t/foo.o | ||
| // RUN: test -f %t/Test.swiftmodule | ||
|
|
||
| //--- test.swift | ||
| func testFunc() {} | ||
|
|
||
| //--- foo.swift | ||
| func foo() {} | ||
|
|
||
| // CACHE-MISS: remark: cache miss for input | ||
| // CACHE-MISS-NOT: remark: replay output file | ||
| // CACHE-HIT: remark: replay output file | ||
| // CACHE-HIT-NOT: remark: cache miss for input | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.