Skip to content

Commit 6901393

Browse files
committed
Addressed reviewer's comments
1 parent a892595 commit 6901393

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

llvm/test/Transforms/Coroutines/coro-split-dbg-nested-struct.ll

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
; Test that nested structs in coroutine frames have correct debug info scoping.
44

5-
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
6-
target triple = "x86_64-unknown-linux-gnu"
7-
8-
; Minimal nested struct types that trigger the scoping issue
5+
; Minimal nested struct types that used to trigger a scoping issue:
6+
; we used to set the wrong `scope` for the `DIDerivedType` member entries of the `DICompositeType`
7+
; as well as the `scope` for `DICompositeType` for the inner struct itself.
98
%"struct.Inner" = type { i32, ptr }
109
%"struct.Outer" = type { %"struct.Inner", i64 }
1110
%"class.Promise" = type { %"struct.Outer" }
@@ -19,7 +18,6 @@ entry:
1918
ret void
2019
}
2120

22-
; The test passes if the debug info is generated without crashing
2321
; CHECK: define void @test_coro_function()
2422

2523
; Check that frame debug info is generated
@@ -29,11 +27,24 @@ entry:
2927
; 1. Promise should be scoped to the frame
3028
; CHECK: ![[PROMISE:[0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "class_Promise", scope: ![[FRAME_TYPE]]
3129

32-
; 2. Outer should be scoped to Promise (not the frame!)
30+
; 2. Members of Promise should be scoped to Promise (check this before Outer since it comes first in output)
31+
; CHECK: !DIDerivedType(tag: DW_TAG_member, name: "struct_Outer", scope: ![[PROMISE]]
32+
33+
; 3. Outer should be scoped to Promise (not the frame!)
3334
; CHECK: ![[OUTER:[0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "struct_Outer", scope: ![[PROMISE]]
3435

35-
; 3. Inner should be scoped to Outer (proper nesting)
36-
; CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "struct_Inner", scope: ![[OUTER]]
36+
; 4. First Outer member should be scoped to Outer
37+
; CHECK: !DIDerivedType(tag: DW_TAG_member, name: "struct_Inner", scope: ![[OUTER]]
38+
39+
; 5. Inner should be scoped to Outer (proper nesting)
40+
; CHECK: ![[INNER:[0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "struct_Inner", scope: ![[OUTER]]
41+
42+
; 6. Members of Inner should be scoped to Inner
43+
; CHECK: !DIDerivedType(tag: DW_TAG_member, name: "__int_32", scope: ![[INNER]]
44+
; CHECK: !DIDerivedType(tag: DW_TAG_member, name: "PointerType", scope: ![[INNER]]
45+
46+
; 7. Second Outer member comes after Inner (due to output order)
47+
; CHECK: !DIDerivedType(tag: DW_TAG_member, name: "__int_64", scope: ![[OUTER]]
3748

3849
declare token @llvm.coro.id(i32, ptr readnone, ptr readonly, ptr)
3950
declare ptr @llvm.coro.begin(token, ptr writeonly)

0 commit comments

Comments
 (0)