Skip to content

Commit df66f27

Browse files
authored
Merge pull request #60509 from hamishknight/insurance-claim
2 parents a1d3884 + 19e1e2f commit df66f27

File tree

5 files changed

+40
-12
lines changed

5 files changed

+40
-12
lines changed

lib/SILGen/SILGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,7 @@ void SILGenModule::emitFunctionDefinition(SILDeclRef constant, SILFunction *f) {
10791079
auto *dd = cast<DestructorDecl>(constant.getDecl());
10801080
preEmitFunction(constant, f, dd);
10811081
PrettyStackTraceSILFunction X("silgen emitDestroyingDestructor", f);
1082+
f->createProfiler(dd, constant, ForDefinition);
10821083
SILGenFunction(*this, *f, dd).emitDestroyingDestructor(dd);
10831084
postEmitFunction(constant, f);
10841085
return;
@@ -1100,7 +1101,6 @@ void SILGenModule::emitFunctionDefinition(SILDeclRef constant, SILFunction *f) {
11001101
auto loc = RegularLocation::getAutoGeneratedLocation(dd);
11011102
preEmitFunction(constant, f, loc);
11021103
PrettyStackTraceSILFunction X("silgen emitDeallocatingDestructor", f);
1103-
f->createProfiler(dd, constant, ForDefinition);
11041104
SILGenFunction(*this, *f, dd).emitDeallocatingDestructor(dd);
11051105
postEmitFunction(constant, f);
11061106
return;

lib/SILGen/SILGenDestructor.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ void SILGenFunction::emitDeallocatingDestructor(DestructorDecl *dd) {
207207
selfForDealloc = B.createUncheckedRefCast(loc, selfForDealloc, classTy);
208208
B.createDeallocRef(loc, selfForDealloc);
209209

210-
emitProfilerIncrement(dd->getTypecheckedBody());
211-
212210
// Return.
213211
B.createReturn(loc, emitEmptyTuple(loc));
214212
}

test/Profiler/coverage_class.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class C {
1010
// CHECK-NEXT: [[@LINE+1]]:10 -> [[@LINE+1]]:12
1111
init() {}
1212

13-
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_class.C.__deallocating_deinit
13+
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_class.C.deinit
1414
// CHECK-NEXT: [[@LINE+1]]:10 -> [[@LINE+1]]:12
1515
deinit {}
1616
}

test/Profiler/coverage_deinit.swift

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -suppress-warnings -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_deinit %s | %FileCheck %s
22
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -emit-ir %s
3-
// REQUIRES: objc_interop
43

5-
import Foundation
4+
func foo() {}
65

7-
public class Derived: NSString {
8-
// CHECK-LABEL: sil @$s15coverage_deinit7DerivedCfD
9-
// CHECK: builtin "int_instrprof_increment"
10-
// CHECK-NEXT: super_method {{.*}} : $Derived, #NSString.deinit!deallocator.foreign
6+
public class Foo {
7+
// CHECK-LABEL: sil @$s15coverage_deinit3FooCfd
8+
// CHECK: integer_literal $Builtin.Int64, 0
9+
// CHECK: integer_literal $Builtin.Int32, 2
10+
// CHECK: integer_literal $Builtin.Int32, 0
11+
// CHECK-NEXT: builtin "int_instrprof_increment"
12+
// CHECK: function_ref @$sSb6randomSbyFZ
13+
// CHECK: cond_br
14+
// CHECK: integer_literal $Builtin.Int64, 0
15+
// CHECK: integer_literal $Builtin.Int32, 2
16+
// CHECK: integer_literal $Builtin.Int32, 1
17+
// CHECK-NEXT: builtin "int_instrprof_increment"
18+
// CHECK-NEXT: // function_ref coverage_deinit.foo() -> ()
1119
deinit {
20+
if .random() {
21+
foo()
22+
}
1223
}
1324
}
1425

15-
// CHECK-LABEL: sil_coverage_map "{{.*}}coverage_deinit.swift" "$s15coverage_deinit7DerivedCfD"
16-
// CHECK-NEXT: [[@LINE-5]]:10 -> [[@LINE-4]]:4 : 0
26+
// CHECK-LABEL: sil_coverage_map "{{.*}}coverage_deinit.swift" "$s15coverage_deinit3FooCfd"
27+
// CHECK-NEXT: [[@LINE-8]]:10 -> [[@LINE-4]]:4 : 0
28+
// CHECK-NEXT: [[@LINE-8]]:8 -> [[@LINE-8]]:17 : 0
29+
// CHECK-NEXT: [[@LINE-9]]:18 -> [[@LINE-7]]:6 : 1
30+
// CHECK-NEXT: [[@LINE-8]]:6 -> [[@LINE-7]]:4 : 0
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -suppress-warnings -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_deinit %s | %FileCheck %s
2+
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -emit-ir %s
3+
// REQUIRES: objc_interop
4+
5+
import Foundation
6+
7+
public class Derived: NSString {
8+
// CHECK-LABEL: sil @$s15coverage_deinit7DerivedCfD
9+
// CHECK: builtin "int_instrprof_increment"
10+
// CHECK-NEXT: super_method {{.*}} : $Derived, #NSString.deinit!deallocator.foreign
11+
deinit {
12+
}
13+
}
14+
15+
// CHECK-LABEL: sil_coverage_map "{{.*}}coverage_deinit_objc.swift" "$s15coverage_deinit7DerivedCfD"
16+
// CHECK-NEXT: [[@LINE-5]]:10 -> [[@LINE-4]]:4 : 0

0 commit comments

Comments
 (0)