Files
swift-mirror/test/Profiler/profiler_serialization.swift
Hamish Knight b12015c343 [SIL] Introduce the increment_profiler_counter instruction
This is a dedicated instruction for incrementing a
profiler counter, which lowers to the
`llvm.instrprof.increment` intrinsic. This
replaces the builtin instruction that was
previously used, and ensures that its arguments
are statically known. This ensures that SIL
optimization passes do not invalidate the
instruction, fixing some code coverage cases in
`-O`.

rdar://39146527
2022-09-07 17:55:13 +01:00

17 lines
780 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module -profile-generate %S/Inputs/profiler_serialized.swift -module-name Foo -o %t/Foo.swiftmodule
// RUN: %target-swift-frontend -emit-sil -profile-generate %t/Foo.swiftmodule | %FileCheck %s
// RUN: %target-swift-frontend -emit-sil -profile-generate -module-name profiler_serialized %s -I %t | %FileCheck %s
// RUN: %target-swift-frontend -emit-ir -profile-generate %s -I %t
import Foo
// CHECK-LABEL: sil shared @$s3Foo19functionToSerializeSiyF
// CHECK: increment_profiler_counter 0, "$s3Foo19functionToSerializeSiyF", num_counters 2, hash 0
// CHECK: increment_profiler_counter 1, "$s3Foo19functionToSerializeSiyF", num_counters 2, hash 0
public func bar() -> Int {
functionToSerialize()
}