mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Update test to be more robust.
This commit is contained in:
5
test/DebugInfo/Inputs/NonInlined.swift
Normal file
5
test/DebugInfo/Inputs/NonInlined.swift
Normal file
@@ -0,0 +1,5 @@
|
||||
public var x = Int64()
|
||||
|
||||
public func use<T>(_ x: T) -> T { return x }
|
||||
|
||||
public func noinline(_ x: Int64) -> Int64 { return use(x) }
|
||||
@@ -1,27 +1,20 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: echo "public var x = Int64()" \
|
||||
// RUN: | %target-swift-frontend -module-name FooBar -emit-module -o %t -
|
||||
// RUN: %target-swift-frontend %s -O -I %t -emit-ir -g -o %t.ll
|
||||
// RUN: %target-swift-frontend -emit-ir -parse-as-library %S/Inputs/NonInlined.swift -emit-module -o %t/NonInlined.ll
|
||||
// RUN: %target-swift-frontend -emit-ir -parse-as-library -g -module-name main %s -O -I %t -o %t.ll
|
||||
// RUN: %FileCheck %s < %t.ll
|
||||
// RUN: %FileCheck %s -check-prefix=TRANSPARENT-CHECK < %t.ll
|
||||
|
||||
// CHECK: define{{( dllexport)?}}{{( protected)?( signext)?}} i32 @main{{.*}}
|
||||
// CHECK: call swiftcc i64 @"$s4main8noinlineys5Int64VADF"(i64 %{{.*}})
|
||||
// CHECK-SAME: !dbg ![[CALL:.*]]
|
||||
// CHECK: define{{.*}}$s4main5entrys5Int64VyF
|
||||
// CHECK-NOT: ret i64
|
||||
// CHECK: call {{.*}}8noinline{{.*}} !dbg ![[CALL:.*]]
|
||||
// CHECK: ret i64
|
||||
// CHECK-DAG: ![[TOPLEVEL:.*]] = !DIFile(filename: "{{.*}}inlinescopes.swift"
|
||||
|
||||
import FooBar
|
||||
|
||||
@inline(never)
|
||||
func use(_ x: Int64) -> Int64 { return x }
|
||||
|
||||
@inline(never)
|
||||
func noinline(_ x: Int64) -> Int64 { return use(x) }
|
||||
import NonInlined
|
||||
|
||||
@_transparent
|
||||
func transparent(_ x: Int64) -> Int64 { return noinline(x) }
|
||||
|
||||
|
||||
@inline(__always)
|
||||
func inlined(_ x: Int64) -> Int64 {
|
||||
let result = transparent(x)
|
||||
@@ -33,5 +26,4 @@ func inlined(_ x: Int64) -> Int64 {
|
||||
// TRANSPARENT-CHECK-NOT: !DISubprogram(name: "transparent"
|
||||
return result
|
||||
}
|
||||
// CHECK-DAG: !DIGlobalVariable(name: "y",{{.*}} file: ![[TOPLEVEL]],{{.*}} line: [[@LINE+1]]
|
||||
public let y = inlined(x)
|
||||
public func entry() -> Int64 { return inlined(x) }
|
||||
|
||||
Reference in New Issue
Block a user