Ignore profile counter instructions in the dihole verifier.

rdar://107764966
This commit is contained in:
Adrian Prantl
2023-04-10 14:17:45 -07:00
parent ff5c5312e8
commit c877a4a802
2 changed files with 17 additions and 0 deletions

View File

@@ -6257,6 +6257,10 @@ public:
for (SILInstruction &SI : *BB) {
if (SI.isMetaInstruction())
continue;
// FIXME: Profile counters for loop bodies may be emitted before the
// instructions for the loop variable, but in a deeper scope.
if (isa<IncrementProfilerCounterInst>(SI))
continue;
if (SI.getLoc().getKind() == SILLocation::CleanupKind)
continue;
// FIXME: These still leave holes in the scopes. We should make them

View File

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