From 238c73e0d43a1291b7dfd91e5cb2587639139584 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 23 Aug 2023 17:07:12 -0700 Subject: [PATCH] Update test to be more robust. --- test/DebugInfo/Inputs/NonInlined.swift | 5 +++++ test/DebugInfo/inlinescopes.swift | 24 ++++++++---------------- 2 files changed, 13 insertions(+), 16 deletions(-) create mode 100644 test/DebugInfo/Inputs/NonInlined.swift diff --git a/test/DebugInfo/Inputs/NonInlined.swift b/test/DebugInfo/Inputs/NonInlined.swift new file mode 100644 index 00000000000..1a423b307ce --- /dev/null +++ b/test/DebugInfo/Inputs/NonInlined.swift @@ -0,0 +1,5 @@ +public var x = Int64() + +public func use(_ x: T) -> T { return x } + +public func noinline(_ x: Int64) -> Int64 { return use(x) } diff --git a/test/DebugInfo/inlinescopes.swift b/test/DebugInfo/inlinescopes.swift index c6bfff7030a..e901a0ca5e1 100644 --- a/test/DebugInfo/inlinescopes.swift +++ b/test/DebugInfo/inlinescopes.swift @@ -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) }