Files
swift-mirror/test/SILOptimizer/pointer-performance.swift
Erik Eckstein 15acfbb268 stdlib: improve debug performance of UnsafePointer.pointer(to:)
Making those functions transparent enables to completely remove the creation of keypaths, even with -Onone.
rdar://127793797
2024-05-16 10:15:53 +02:00

18 lines
509 B
Swift

// RUN: %target-swift-frontend %s -module-name=test -parse-as-library -emit-sil | %FileCheck %s
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
public struct S {
var a: Int
var b: Int
}
// Check that even with -Onone, no keypath is created.
// CHECK-LABEL: sil @$s4test6testitySPySiGSgSPyAA1SVGF :
// CHECK-NOT: keypath
// CHECK: } // end sil function '$s4test6testitySPySiGSgSPyAA1SVGF'
public func testit(_ p: UnsafePointer<S>) -> UnsafePointer<Int>? {
return p.pointer(to: \.b)
}