Update test to be more robust.

This commit is contained in:
Adrian Prantl
2023-08-23 17:07:12 -07:00
parent f1d2e8f965
commit 238c73e0d4
2 changed files with 13 additions and 16 deletions

View 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) }

View File

@@ -1,27 +1,20 @@
// RUN: %empty-directory(%t) // RUN: %empty-directory(%t)
// RUN: echo "public var x = Int64()" \ // RUN: %target-swift-frontend -emit-ir -parse-as-library %S/Inputs/NonInlined.swift -emit-module -o %t/NonInlined.ll
// RUN: | %target-swift-frontend -module-name FooBar -emit-module -o %t - // RUN: %target-swift-frontend -emit-ir -parse-as-library -g -module-name main %s -O -I %t -o %t.ll
// RUN: %target-swift-frontend %s -O -I %t -emit-ir -g -o %t.ll
// RUN: %FileCheck %s < %t.ll // RUN: %FileCheck %s < %t.ll
// RUN: %FileCheck %s -check-prefix=TRANSPARENT-CHECK < %t.ll // RUN: %FileCheck %s -check-prefix=TRANSPARENT-CHECK < %t.ll
// CHECK: define{{( dllexport)?}}{{( protected)?( signext)?}} i32 @main{{.*}} // CHECK: define{{.*}}$s4main5entrys5Int64VyF
// CHECK: call swiftcc i64 @"$s4main8noinlineys5Int64VADF"(i64 %{{.*}}) // CHECK-NOT: ret i64
// CHECK-SAME: !dbg ![[CALL:.*]] // CHECK: call {{.*}}8noinline{{.*}} !dbg ![[CALL:.*]]
// CHECK: ret i64
// CHECK-DAG: ![[TOPLEVEL:.*]] = !DIFile(filename: "{{.*}}inlinescopes.swift" // CHECK-DAG: ![[TOPLEVEL:.*]] = !DIFile(filename: "{{.*}}inlinescopes.swift"
import FooBar import NonInlined
@inline(never)
func use(_ x: Int64) -> Int64 { return x }
@inline(never)
func noinline(_ x: Int64) -> Int64 { return use(x) }
@_transparent @_transparent
func transparent(_ x: Int64) -> Int64 { return noinline(x) } func transparent(_ x: Int64) -> Int64 { return noinline(x) }
@inline(__always) @inline(__always)
func inlined(_ x: Int64) -> Int64 { func inlined(_ x: Int64) -> Int64 {
let result = transparent(x) let result = transparent(x)
@@ -33,5 +26,4 @@ func inlined(_ x: Int64) -> Int64 {
// TRANSPARENT-CHECK-NOT: !DISubprogram(name: "transparent" // TRANSPARENT-CHECK-NOT: !DISubprogram(name: "transparent"
return result return result
} }
// CHECK-DAG: !DIGlobalVariable(name: "y",{{.*}} file: ![[TOPLEVEL]],{{.*}} line: [[@LINE+1]] public func entry() -> Int64 { return inlined(x) }
public let y = inlined(x)