Files
swift-mirror/test/DebugInfo/discriminators_for_profiling.swift
Kavon Farvardin 19e593bc07 PGO: new -debug-info-for-profiling frontend flag
This achieves the same as clang's `-fdebug-info-for-profiling`, which
emits DWARF discriminators to aid in narrowing-down which basic block
corresponds to a particular instruction address. This is particularly
useful for sampling-based profiling.

rdar://135443278
2024-11-01 11:59:54 -07:00

17 lines
404 B
Swift

// RUN: %target-swift-frontend %s -emit-ir -g -debug-info-for-profiling -o - | %FileCheck %s
// CHECK: distinct !DICompileUnit(language: DW_LANG_Swift
// CHECK-SAME: debugInfoForProfiling: true
// CHECK: !DILexicalBlockFile({{.*}} discriminator: 2)
public func lobster(_ n: Int) -> Bool {
guard n > 0 else { fatalError("too cold!") }
if n > 100 {
print("warm but ok")
}
return n < 120
}