Skip to content

Commit 1aab800

Browse files
authored
Merge pull request #32389 from keith/ks/cp-wmo-coverage
5.3: Emit coverage mappings for all modules
2 parents 865b3b7 + d4c5b7a commit 1aab800

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,8 +1104,11 @@ void IRGenerator::emitGlobalTopLevel(llvm::StringSet<> *linkerDirectives) {
11041104
IGM->emitSILDifferentiabilityWitness(&dw);
11051105
}
11061106

1107-
// Emit code coverage mapping data.
1108-
PrimaryIGM->emitCoverageMapping();
1107+
// Emit code coverage mapping data for all modules
1108+
for (auto Iter : *this) {
1109+
IRGenModule *IGM = Iter.second;
1110+
IGM->emitCoverageMapping();
1111+
}
11091112

11101113
for (auto Iter : *this) {
11111114
IRGenModule *IGM = Iter.second;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
func func1() {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
func func2() {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 0 -emit-ir %S/Inputs/coverage_num_threads1.swift | %FileCheck %s -check-prefix=SINGLE-SOURCE --implicit-check-not="llvm_coverage_mapping ="
2+
3+
// SINGLE-SOURCE: llvm_coverage_mapping =
4+
5+
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 0 -emit-ir %S/Inputs/coverage_num_threads1.swift %S/Inputs/coverage_num_threads2.swift | %FileCheck %s -check-prefix=SINGLE-OBJECT --implicit-check-not="llvm_coverage_mapping ="
6+
7+
// SINGLE-OBJECT: llvm_coverage_mapping =
8+
9+
// Using 1 goes down the multithreaded codepath but only operates with a single thread to work around an issue on Windows where the output of both IR modules is interleaved and therefore the output is invalid
10+
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -num-threads 1 -emit-ir %S/Inputs/coverage_num_threads1.swift %S/Inputs/coverage_num_threads2.swift | %FileCheck %s -check-prefix=MULTIPLE-OBJECTS --implicit-check-not="llvm_coverage_mapping ="
11+
12+
// MULTIPLE-OBJECTS: llvm_coverage_mapping =
13+
// MULTIPLE-OBJECTS: llvm_coverage_mapping =

0 commit comments

Comments
 (0)