File: inlinedAt.swift

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (50 lines) | stat: -rw-r--r-- 1,779 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
48
49
50
// RUN: %target-swift-frontend %s -O -I %t -emit-sil -emit-verbose-sil -o - \
// RUN:    | %FileCheck %s --check-prefix=CHECK-SIL
// RUN: %target-swift-frontend %s -O -I %t -emit-ir -g -o - | %FileCheck %s

public var glob : Int = 0
@inline(never) public func hold(_ n : Int) { glob = n }

#sourceLocation(file: "abc.swift", line: 100)
@inline(__always)
func h(_ k : Int) -> Int {      // 101
  hold(k)                       // 102
  return k                      // 103
}

#sourceLocation(file: "abc.swift", line: 200)
@inline(__always)
func g(_ j : Int) -> Int {      // 201
  hold(j)                       // 202
  return h(j)                   // 203
}

#sourceLocation(file: "abc.swift", line: 301)
public func f(_ i : Int) -> Int { // 301
  return g(i)                     // 302
}

// CHECK-SIL: sil {{.*}}@$s9inlinedAt1fyS2iF :
// CHECK-SIL-NOT: return
// CHECK-SIL: debug_value %0 : $Int, let, name "k", argno 1
// CHECK-SIL-SAME: line:101:10:in_prologue
// CHECK-SIL-SAME: perf_inlined_at line:203:10
// CHECK-SIL-SAME: perf_inlined_at line:302:10

// CHECK: define {{.*}}@"$s9inlinedAt1fyS2iF"({{.*}})
// CHECK-NOT: ret
// CHECK: #dbg_value
// CHECK: #dbg_value
// CHECK: #dbg_value({{.*}}), ![[L1:.*]])

// CHECK: ![[F:.*]] = distinct !DISubprogram(name: "f",
// CHECK: ![[G:.*]] = distinct !DISubprogram(name: "g",

// CHECK: ![[L3:.*]] = distinct !DILocation(line: 302, column: 10,
// CHECK-SAME:                              scope: ![[F:.*]])
// CHECK: ![[H:.*]] = distinct !DISubprogram(name: "h",
// CHECK: ![[L1]] = !DILocation(line: 101, column: 8, scope: ![[H]],
// CHECK-SAME:                  inlinedAt: ![[L2:.*]])
// CHECK: ![[L2]] = distinct !DILocation(line: 203, column: 10, scope: ![[G]],
// CHECK-SAME:                           inlinedAt: ![[L3]])