File: inline_terminator_scopes.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 (75 lines) | stat: -rw-r--r-- 3,171 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// RUN: %target-sil-opt -enable-sil-verify-all %s -inline -sil-print-debuginfo | %FileCheck %s

// Generated from:
// func g(_ x: Int64) -> Int64 {
//   if (x > 0) {
//     return 1
//   }
//   return 0
// }
//  
// public func f(_ x: Int64) -> Int64 { return g(x) }

// CHECK: sil @$s1a1gys5Int64VADF : $@convention(thin) (Int64) -> Int64 {
// CHECK: bb0(%0 : $Int64):
// CHECK-NEXT:   scope [[SCOPE_10:[0-9]+]]
// CHECK:        cond_br {{.*}}, bb1, bb2, loc "t.swift":2:9, scope [[SCOPE_10]]
// CHECK:      bb1:
// CHECK-NEXT:   scope [[SCOPE_11:[0-9]+]]
// CHECK:        br bb3({{.*}} : $Int64), loc "t.swift":3:5, scope [[SCOPE_11]]
// CHECK:      bb2:
// CHECK-NEXT:   scope [[SCOPE_9:[0-9]+]]
// CHECK:        br bb3({{.*}} : $Int64), loc "t.swift":5:3, scope [[SCOPE_9]]
// CHECK:      bb3({{.*}} : $Int64):

sil_stage canonical

import Builtin
import Swift
import SwiftShims

func g(_ x: Int64) -> Int64

public func f(_ x: Int64) -> Int64

sil_scope 1 { loc "t.swift":1:6 parent @$s1a1gys5Int64VADF : $@convention(thin) (Int64) -> Int64 }
sil_scope 2 { loc "t.swift":1:29 parent 1 }
sil_scope 3 { loc "t.swift":2:3 parent 2 }
sil_scope 4 { loc "t.swift":2:14 parent 3 }

// g(_:)
sil @$s1a1gys5Int64VADF : $@convention(thin) (Int64) -> Int64 {
// %0 "x"                                         // users: %3, %1
bb0(%0 : $Int64):
  %2 = integer_literal $Builtin.Int64, 0, loc "t.swift":2:11, scope 3 // user: %4
  %3 = struct_extract %0 : $Int64, #Int64._value, loc "t.swift":2:9, scope 3 // user: %4
  %4 = builtin "cmp_slt_Int64"(%2 : $Builtin.Int64, %3 : $Builtin.Int64) : $Builtin.Int1, loc "t.swift":2:9, scope 3 // user: %5
  cond_br %4, bb1, bb2, loc "t.swift":2:9, scope 3 // id: %5

bb1:                                              // Preds: bb0
  %6 = integer_literal $Builtin.Int64, 1, loc "t.swift":3:12, scope 4 // user: %7
  %7 = struct $Int64 (%6 : $Builtin.Int64), loc "t.swift":3:12, scope 4 // user: %8
  br bb3(%7 : $Int64), loc "t.swift":3:5, scope 4 // id: %8

bb2:                                              // Preds: bb0
  %9 = integer_literal $Builtin.Int64, 0, loc "t.swift":5:10, scope 2 // user: %10
  %10 = struct $Int64 (%9 : $Builtin.Int64), loc "t.swift":5:10, scope 2 // user: %11
  br bb3(%10 : $Int64), loc "t.swift":5:3, scope 2 // id: %11

// %12                                            // user: %13
bb3(%12 : $Int64):                                // Preds: bb2 bb1
  return %12 : $Int64, loc "t.swift":6:1, scope 2 // id: %13
} // end sil function '$s1a1gys5Int64VADF'

sil_scope 7 { loc "t.swift":8:13 parent @$s1a1fys5Int64VADF : $@convention(thin) (Int64) -> Int64 }
sil_scope 8 { loc "t.swift":8:36 parent 7 }

// f(_:)
sil @$s1a1fys5Int64VADF : $@convention(thin) (Int64) -> Int64 {
// %0 "x"                                         // users: %3, %1
bb0(%0 : $Int64):
  // function_ref g(_:)
  %2 = function_ref @$s1a1gys5Int64VADF : $@convention(thin) (Int64) -> Int64, loc "t.swift":8:45, scope 8 // user: %3
  %3 = apply %2(%0) : $@convention(thin) (Int64) -> Int64, loc "t.swift":8:45, scope 8 // user: %4
  return %3 : $Int64, loc "t.swift":8:38, scope 8 // id: %4
} // end sil function '$s1a1fys5Int64VADF'