Skip to content

Commit d026627

Browse files
committed
Ignore profile counter instructions in the dihole verifier.
rdar://107764966 (cherry picked from commit c877a4a)
1 parent ddf892b commit d026627

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6256,6 +6256,10 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
62566256
for (SILInstruction &SI : *BB) {
62576257
if (SI.isMetaInstruction())
62586258
continue;
6259+
// FIXME: Profile counters for loop bodies may be emitted before the
6260+
// instructions for the loop variable, but in a deeper scope.
6261+
if (isa<IncrementProfilerCounterInst>(SI))
6262+
continue;
62596263
if (SI.getLoc().getKind() == SILLocation::CleanupKind)
62606264
continue;
62616265
// FIXME: These still leave holes in the scopes. We should make them

test/DebugInfo/profile_counter.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %target-swift-frontend %s -g -emit-sil -profile-generate -profile-coverage-mapping -parse-as-library -o - | %FileCheck %s
2+
3+
func consume<T>(_ t: T) {}
4+
5+
public func f<T>(collection : [T]) {
6+
for element in collection {
7+
// CHECK: increment_profiler_counter {{.*}}:[[@LINE-1]]:29, scope [[SCOPE:[0-9]+]]
8+
// FIXME: Ideally, these would share the same scope, or the increment should come below the variable initialization code.
9+
// CHECK: unchecked_take_enum_data_addr {{.*}}:[[@LINE-3]]:3, scope
10+
// CHECK: copy_addr {{.*}}:[[@LINE-4]]:29, scope [[SCOPE]]
11+
consume(element)
12+
}
13+
}

0 commit comments

Comments
 (0)