|
1 |
| -// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s |
2 |
| - |
| 1 | +// RUN: %target-swift-frontend %s -emit-sil -Xllvm -sil-print-debuginfo -Xllvm -sil-print-debuginfo-verbose -g -o - | %FileCheck %s --check-prefix=SILCHECK |
| 2 | +// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s --check-prefix=IRCHECK |
3 | 3 | func markUsed<T>(_ t: T) {}
|
4 | 4 |
|
5 | 5 | func foo(_ x: inout Int64) {
|
| 6 | + |
| 7 | + // Make sure that the begin_access, load, and end_access instructions |
| 8 | + // are not marked as isImplicit: true. They should not be implicit |
| 9 | + // because they are generated from a member_ref_expr which is the |
| 10 | + // lvalue SubExpr of a LoadExpr. LoadExpr's are always implicit, but |
| 11 | + // that doesn't necessarily mean their SubExprs are implicit as well. |
| 12 | + // SILCHECK: sil hidden @$s4main3fooyys5Int64VzF |
| 13 | + // SILCHECK: debug_value %0, var, name "x", argno 1, expr op_deref, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false, scope 7 // id: %1 |
| 14 | + // SILCHECK: begin_access [read] [static] %0, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false |
| 15 | + // SILCHECK-NEXT: load %2, loc {{.*}} isImplicit: false, isAutoGenerated: false, isHiddenFromDebugInfo: false |
| 16 | + // SILCHECK-NEXT: end_access %2, loc * {{.*}} isImplicit: false, isAutoGenerated: true, isHiddenFromDebugInfo: true |
| 17 | + |
6 | 18 | // Make sure the shadow copy is being made in the prologue or (at
|
7 | 19 | // line 0), but the code to load the value from the inout storage is
|
8 | 20 | // not.
|
9 |
| - // CHECK: define hidden swiftcc void @"$s4main3fooyys5Int64VzF" |
10 |
| - // CHECK: %[[X:.*]] = alloca ptr, align {{(4|8)}} |
11 |
| - // CHECK-NEXT: #dbg_declare |
12 |
| - // CHECK-NEXT: call void @llvm.memset.{{.*}}(ptr align {{(4|8)}} %[[X]], i8 0 |
13 |
| - // CHECK: store ptr %0, ptr %[[X]], align {{(4|8)}} |
14 |
| - // CHECK-SAME: !dbg ![[LOC0:.*]] |
15 |
| - // CHECK-NEXT: getelementptr inbounds %Ts5Int64V, ptr %0, i32 0, i32 0, |
16 |
| - // CHECK-SAME: !dbg ![[LOC0]] |
17 |
| - // CHECK: ![[LOC0]] = !DILocation(line: 0, |
18 |
| - // CHECK: !DILocation(line: [[@LINE+1]], |
| 21 | + // IRCHECK: define hidden swiftcc void @"$s4main3fooyys5Int64VzF" |
| 22 | + // IRCHECK: %[[X:.*]] = alloca ptr, align {{(4|8)}} |
| 23 | + // IRCHECK-NEXT: #dbg_declare |
| 24 | + // IRCHECK-NEXT: call void @llvm.memset.{{.*}}(ptr align {{(4|8)}} %[[X]], i8 0 |
| 25 | + // IRCHECK: store ptr %0, ptr %[[X]], align {{(4|8)}} |
| 26 | + // IRCHECK-SAME: !dbg ![[LOC0:.*]] |
| 27 | + // IRCHECK-NEXT: %[[VALUE:.*]] = getelementptr inbounds %Ts5Int64V, ptr %0, i32 0, i32 0, |
| 28 | + // IRCHECK-SAME: !dbg ![[LOCLOAD:.*]] |
| 29 | + // IRCHECK-NEXT: load i64, ptr %[[VALUE]], align {{(4|8)}} |
| 30 | + // IRCHECK-SAME: !dbg ![[LOCLOAD]] |
| 31 | + // IRCHECK: ![[LOC0]] = !DILocation(line: 0, |
| 32 | + // IRCHECK: !DILocation(line: [[@LINE+1]], |
19 | 33 | x = x + 2
|
20 | 34 | }
|
21 | 35 |
|
|
0 commit comments