Files
swift-mirror/test/SILOptimizer/inline_tryApply.sil
Adrian Prantl 5ea2d13f5e Improve the performance of IRGenDebugInfo
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
2017-04-05 08:33:55 -07:00

37 lines
1.2 KiB
Plaintext

// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all %s -early-inline -sil-inline-threshold=50 | %FileCheck %s
sil_stage canonical
import Builtin
import Swift
import SwiftShims
//CHECK-LABEL: sil @caller_function
//CHECK-NOT: try_apply
//CHECK: throw {{.*}} : $Error
sil @caller_function : $@convention(thin) () -> @error Error {
bb0:
// function_ref main.inner () throws -> ()
%0 = function_ref @callee_function : $@convention(thin) () -> @error Error // user: %1
try_apply %0() : $@convention(thin) () -> @error Error, normal bb1, error bb2 // id: %1
bb1(%2 : $()): // Preds: bb0
%3 = tuple () // user: %4
return %3 : $() // id: %4
bb2(%5 : $Error): // Preds: bb0
throw %5 : $Error // id: %6
}
//CHECK-LABEL: sil [always_inline] @callee_function
//CHECK: return
// main.inner () throws -> ()
sil [always_inline] @callee_function : $@convention(thin) () -> @error Error {
bb0:
%0 = tuple () // user: %1
return %0 : $() // id: %1
}