Skip to content

Commit 816f606

Browse files
committed
Pre-commit debug_scope_distinct.swift LIT test
1 parent 493a25f commit 816f606

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

test/IRGen/debug_scope_distinct.swift

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swiftc_driver -DM -emit-module -emit-module-path %t/M.swiftmodule %s -module-name M
3+
// RUN: %target-swiftc_driver -O -g -I %t -c %s -emit-ir -o - | %FileCheck %s
4+
5+
// CHECK: define {{.*}} void @"$s4main1TV4move2byyAC13TangentVectorV_tF"
6+
// CHECK-SAME: ptr {{.*}} %[[ARG_PTR:.*]],
7+
//
8+
// CHECK: %[[ARG0:.*]] = load {{.*}} %[[ARG_PTR]]
9+
// CHECK: call void @llvm.dbg.value(metadata {{.*}} %[[ARG0]], metadata ![[VAR1:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg ![[LOC1:[0-9]+]]
10+
// CHECK: %[[ARG1_GEP:.*]] = getelementptr inbounds i8, ptr %[[ARG_PTR]], i64 8
11+
// CHECK: %[[ARG1:.*]] = load {{.*}} %[[ARG1_GEP]]
12+
// CHECK: call void @llvm.dbg.value(metadata {{.*}} %[[ARG1]], metadata ![[VAR1]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 8)), !dbg ![[LOC1]]
13+
//
14+
// CHECK: %[[ARG2_GEP:.*]] = getelementptr inbounds %T4main1TV13TangentVectorV, ptr %[[ARG_PTR]], i64 0, i32 2
15+
// CHECK: %[[ARG2:.*]] = load {{.*}} %[[ARG2_GEP]]
16+
// CHECK: call void @llvm.dbg.value(metadata {{.*}} %[[ARG2]], metadata ![[VAR1]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)), !dbg ![[LOC1]]
17+
// CHECK: %[[ARG3_GEP:.*]] = getelementptr inbounds %T4main1TV13TangentVectorV, ptr %[[ARG_PTR]], i64 0, i32 2, i32 0, i32 1
18+
// CHECK: %[[ARG3:.*]] = load {{.*}} %[[ARG3_GEP]]
19+
// CHECK: call void @llvm.dbg.value(metadata {{.*}} %[[ARG3]], metadata ![[VAR1]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 8)), !dbg ![[LOC1]]
20+
21+
// CHECK-DAG: ![[VAR1]] = !DILocalVariable(name: "offset", arg: 1, scope: ![[SCOPE:[0-9]+]]
22+
23+
// CHECK-DAG: ![[LOC1]] = !DILocation(line: 0, scope: ![[SCOPE]], inlinedAt: ![[LOCINL1:[0-9]+]])
24+
// CHECK-DAG: ![[LOCINL1]] = !DILocation(line: 0, scope: ![[SUBPROG:[0-9]+]])
25+
// CHECK-DAG: ![[SUBPROG]] = distinct !DISubprogram(name: "move", linkageName: "$s4main1TV4move2byyAC13TangentVectorV_tF"
26+
27+
#if M
28+
import _Differentiation
29+
30+
public struct S<T> {
31+
class C {}
32+
let c: C
33+
internal var b: Int8
34+
init(_ initb: Int8) {
35+
b = initb;
36+
c = C();
37+
}
38+
}
39+
40+
extension S: AdditiveArithmetic {
41+
public static var zero: S { let ret = S(0); return ret; }
42+
public static func == (_ lhs: S, _ rhs: S) -> Bool { return lhs.b == rhs.b; }
43+
public static func + (_ lhs: S, _ rhs: S) -> S { var ret = lhs; ret.b += rhs.b; return ret; }
44+
public static func - (_ lhs: S, _ rhs: S) -> S { var ret = lhs; ret.b -= rhs.b; return ret; }
45+
}
46+
47+
extension S: Differentiable {
48+
public typealias TangentVector = S
49+
}
50+
51+
#else
52+
import _Differentiation
53+
import M
54+
55+
struct T: Differentiable {
56+
var u1: U
57+
var u2: U
58+
}
59+
60+
struct U: Differentiable {
61+
var s: S<Float>
62+
var v: V
63+
}
64+
65+
struct V: Differentiable {
66+
var s: S<Float>
67+
}
68+
#endif

0 commit comments

Comments
 (0)