mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When enabling the option `-sil-opt-profile-repeat=<n>`, the optimizer runs passes n times and reports the total runtime at the end of the pass pipeline. This is useful to profile a specific optimization pass with `sil-opt`. For example, to profile the stack promotion pass: ``` sil-opt -stack-promotion -sil-opt-profile-repeat=10000 -o /dev/null test.sil ```
28 lines
509 B
Plaintext
28 lines
509 B
Plaintext
// RUN: %target-sil-opt -stack-promotion -sil-opt-profile-repeat=10 %s -o /dev/null 2>&1 | %FileCheck %s
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
|
|
// CHECK: {{.*}} ms: total runtime of all passes
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
import SwiftShims
|
|
|
|
class XX {
|
|
@_hasStorage var x: Int32
|
|
|
|
init()
|
|
}
|
|
|
|
sil @simple_promote : $@convention(thin) () -> Int32 {
|
|
bb0:
|
|
%o1 = alloc_ref $XX
|
|
%l1 = ref_element_addr %o1 : $XX, #XX.x
|
|
%l2 = load %l1 : $*Int32
|
|
strong_release %o1 : $XX
|
|
return %l2 : $Int32
|
|
}
|
|
|