mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This commit changes how inline information is stored in SILDebugScope from a tree to a linear chain of inlined call sites (similar to what LLVM is using). This makes creating inlined SILDebugScopes slightly more expensive, but makes lowering SILDebugScopes into LLVM metadata much faster because entire inlined-at chains can now be cached. This means that SIL is no longer preserve the inlining history (i.e., ((a was inlined into b) was inlined into c) is represented the same as (a was inlined into (b was inlined into c)), but this information was not used by anyone. On my late 2012 i7 iMac, this saves about 4 seconds when compiling the RelWithDebInfo x86_64 swift standard library — or 40% of IRGen time. rdar://problem/28311051
55 lines
2.0 KiB
Swift
55 lines
2.0 KiB
Swift
// 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 {{.*}}@_T09inlinedAt1fS2iF :
|
|
// 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 {{.*}}@_T09inlinedAt1fS2iF({{.*}})
|
|
// CHECK-NOT: ret
|
|
// CHECK: @llvm.dbg.value
|
|
// CHECK: @llvm.dbg.value
|
|
// CHECK: @llvm.dbg.value({{.*}}), !dbg ![[L1:.*]]
|
|
|
|
// CHECK: ![[F:.*]] = distinct !DISubprogram(name: "f",
|
|
// CHECK: ![[G:.*]] = distinct !DISubprogram(name: "g",
|
|
|
|
// CHECK: ![[L3:.*]] = !DILocation(line: 302, column: 13,
|
|
// CHECK-SAME: scope: ![[F_SCOPE:.*]])
|
|
// CHECK: ![[F_SCOPE]] = distinct !DILexicalBlock(scope: ![[F]],
|
|
// CHECK-SAME: line: 301, column: 33)
|
|
// CHECK: ![[G_SCOPE:.*]] = distinct !DILexicalBlock(scope: ![[G]],
|
|
// CHECK-SAME: line: 201, column: 26)
|
|
// CHECK: ![[H:.*]] = distinct !DISubprogram(name: "h",
|
|
// CHECK: ![[L1]] = !DILocation(line: 101, column: 8, scope: ![[H]],
|
|
// CHECK-SAME: inlinedAt: ![[L2:.*]])
|
|
// CHECK: ![[L2]] = !DILocation(line: 203, column: 13, scope: ![[G_SCOPE]],
|
|
// CHECK-SAME: inlinedAt: ![[L3]])
|
|
|