mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Type annotations for instruction operands are omitted, e.g. ``` %3 = struct $S(%1, %2) ``` Operand types are redundant anyway and were only used for sanity checking in the SIL parser. But: operand types _are_ printed if the definition of the operand value was not printed yet. This happens: * if the block with the definition appears after the block where the operand's instruction is located * if a block or instruction is printed in isolation, e.g. in a debugger The old behavior can be restored with `-Xllvm -sil-print-types`. This option is added to many existing test files which check for operand types in their check-lines.
76 lines
3.1 KiB
Plaintext
76 lines
3.1 KiB
Plaintext
// RUN: %target-sil-opt -sil-print-types -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'
|