mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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
22 lines
902 B
Swift
22 lines
902 B
Swift
// RUN: %target-swift-frontend -parse-as-library -emit-silgen -profile-generate %s | %FileCheck %s
|
|
|
|
// CHECK: sil hidden [ossa] @[[F_OPERATORS:.*operators.*]] :
|
|
// CHECK: increment_profiler_counter 0, "{{.*}}instrprof_operators.swift:[[F_OPERATORS]]", num_counters 2, hash
|
|
func operators(a : Bool, b : Bool) {
|
|
let c = a && b
|
|
let d = a || b
|
|
|
|
// CHECK: increment_profiler_counter 1, "{{.*}}instrprof_operators.swift:[[F_OPERATORS]]", num_counters 2, hash
|
|
let e = c ? a : b
|
|
|
|
// CHECK-NOT: increment_profiler_counter
|
|
}
|
|
|
|
// CHECK: implicit closure
|
|
// CHECK: increment_profiler_counter 0, "{{.*}}:$s19instrprof_operators0B01a1bySb_SbtFSbyKXEfu_", num_counters 1, hash
|
|
// CHECK-NOT: increment_profiler_counter
|
|
|
|
// CHECK: implicit closure
|
|
// CHECK: increment_profiler_counter 0, "{{.*}}:$s19instrprof_operators0B01a1bySb_SbtFSbyKXEfu0_", num_counters 1, hash
|
|
// CHECK-NOT: increment_profiler_counter
|