mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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.
51 lines
1.8 KiB
Swift
51 lines
1.8 KiB
Swift
// RUN: %target-swift-frontend %s -O -I %t -Xllvm -sil-print-types -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]])
|
|
|