[Profiler] Separate profiler instances for property inits and constructors (#25247)

Assign separate SILProfiler instances to stored property initializers
and constructors.

Starting with rdar://39460313, coverage reporting for these constructs
was bundled up into a single SILProfiler uniqued by the NominalTypeDecl.
There are two problems with doing this.

First, the shared SILProfiler is given a fake name that can't be
demangled. That breaks Xcode's reports.  Second, the relationship
between SILProfiler and SILFunction is supposed to be 1:1. Having a
shared SILProfiler muddies things a bit and requires extra bookkeeping.

rdar://47467864
This commit is contained in:
Vedant Kumar
2019-06-05 10:38:10 -07:00
committed by GitHub
parent 27b56b17f9
commit 569c8afc54
14 changed files with 171 additions and 207 deletions

View File

@@ -1,5 +1,16 @@
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_catch %s | %FileCheck %s
struct S {
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_catch.S.init() -> coverage_catch.S
init() { // CHECK: [[@LINE]]:10 -> [[@LINE+6]]:4 : 0
do { // CHECK: [[@LINE]]:8 -> [[@LINE+2]]:6 : 0
throw SomeErr.Err1
} catch {
// CHECK: [[@LINE-1]]:13 -> [[@LINE+1]]:6 : 1
} // CHECK: [[@LINE]]:6 -> [[@LINE+1]]:4 : 0
}
}
enum SomeErr : Error {
case Err1
case Err2
@@ -109,14 +120,3 @@ func joo() -> Int {
} while false // CHECK: [[@LINE]]:11 {{.*}} : (1 - 2)
return 1
}
struct S {
// CHECK: sil_coverage_map {{.*}}// __ntd_S_line:[[@LINE-1]]
init() {
do {
throw SomeErr.Err1
} catch {
// CHECK: [[@LINE-1]]:13 -> [[@LINE+1]]:6 : 1
} // CHECK: [[@LINE]]:6 -> [[@LINE+1]]:4 : 0
}
}