File: rdar77217762.sil

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (47 lines) | stat: -rw-r--r-- 1,454 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

// rdar://77217762 – The increment_profiler_counter in $foo gets optimized out by
// LLVM function optimization, but make sure we still emit the name data which
// is required by the coverage record.

// Make sure both the legacy and new pass manager work.
// We need to disable SIL optimizations to ensure LLVM optimizes out the
// profiler increment.
// RUN: %target-swift-frontend -emit-ir -profile-generate -profile-coverage-mapping -O -disable-sil-perf-optzns -disable-new-llvm-pass-manager %s | %FileCheck %s
// RUN: %target-swift-frontend -emit-ir -profile-generate -profile-coverage-mapping -O -disable-sil-perf-optzns -enable-new-llvm-pass-manager %s | %FileCheck %s

sil_stage canonical

import Swift
import Builtin

// CHECK-DAG: @__covrec
// CHECK-DAG: @__llvm_coverage_mapping
// CHECK-DAG: @__llvm_prf_nm

sil [ossa] @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
  %2 = integer_literal $Builtin.Int32, 0
  %3 = struct $Int32 (%2 : $Builtin.Int32)
  return %3 : $Int32
}

sil [ossa] @$foo : $@convention(thin) () -> () {
bb0:
  %1 = integer_literal $Builtin.Int1, 0
  cond_br %1, bb1, bb2

bb1:
  increment_profiler_counter 0, "$foo", num_counters 1, hash 0
  br bb3

bb2:
  br bb3

bb3:
  %10 = tuple ()
  return %10 : $()
}

sil_coverage_map "main.swift" "$foo" "$foo" 0 {
  10:6 -> 10:11 : 0
}