Skip to content

Commit 7be3973

Browse files
authored
[DebugInfo][test] Fix llvm/test/ThinLTO/X86/pr35472.ll (NFC) (#170952)
The test is intended to verify lazy loading of debug-location scope metadata. However, after d5d3eb1, DILexicalScope that was expected to be lazily loaded was not used in IR, so lazy loading did not occur. This patch fixes that, and adds an extra bcanalyzer check to ensure that DILexicalScope record is emitted.
1 parent 7c9aa14 commit 7be3973

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

llvm/test/ThinLTO/X86/pr35472.ll

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,35 @@
88
; RUN: llvm-lto -thinlto-action=run %t1.bc %t2.bc -exported-symbol=_Z5Alphav
99
; RUN: llvm-nm %t1.bc.thinlto.o | FileCheck %s -check-prefix=ThinLTOa
1010
; RUN: llvm-nm %t2.bc.thinlto.o | FileCheck %s -check-prefix=ThinLTOb
11+
; RUN: llvm-bcanalyzer -dump %t1.bc | FileCheck %s --implicit-check-not='<METADATA_BLOCK'
1112

1213
; ThinLTOa-DAG: T _Z5Bravov
1314
; ThinLTOa-DAG: W _ZN4EchoD2Ev
1415
; ThinLTOb-DAG: T _Z5Alphav
1516

17+
; Make sure that lexical block was emitted into the module level metadata block,
18+
; and that metadata index for the module level metadata block is present, as it
19+
; is necessary to trigger lazy loading.
20+
; CHECK: <MODULE_BLOCK
21+
; CHECK: <METADATA_BLOCK
22+
; CHECK: <INDEX_OFFSET
23+
; CHECK: <LEXICAL_BLOCK
24+
; CHECK: <INDEX
25+
; CHECK: </METADATA_BLOCK>
26+
; CHECK: <FUNCTION_BLOCK
27+
; CHECK: <METADATA_BLOCK
28+
; CHECK: </METADATA_BLOCK>
29+
; CHECK: </FUNCTION_BLOCK
30+
; CHECK: <FUNCTION_BLOCK
31+
; CHECK: <METADATA_BLOCK
32+
; CHECK: </METADATA_BLOCK>
33+
; CHECK: </FUNCTION_BLOCK
34+
; CHECK: <FUNCTION_BLOCK
35+
; CHECK: <METADATA_BLOCK
36+
; CHECK: </METADATA_BLOCK>
37+
; CHECK: </FUNCTION_BLOCK
38+
; CHECK: </MODULE_BLOCK
39+
1640
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
1741
target triple = "x86_64-unknown-linux-gnu"
1842

@@ -36,14 +60,14 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
3660
define linkonce_odr void @_ZN4EchoD2Ev(ptr %this) unnamed_addr comdat align 2 {
3761
%this.addr.i = alloca ptr, align 8
3862
call void @llvm.dbg.declare(metadata ptr %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !32
39-
%this1.i = load ptr, ptr %this.addr.i, align 8
63+
%this1.i = load ptr, ptr %this.addr.i, align 8, !dbg !33
4064
ret void
4165
}
4266

4367
define linkonce_odr void @_ZN5DeltaD2Ev(ptr %this) unnamed_addr comdat align 2 !dbg !36 {
4468
%this.addr.i = alloca ptr, align 8
4569
call void @llvm.dbg.declare(metadata ptr %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !41
46-
%this1.i = load ptr, ptr %this.addr.i, align 8
70+
%this1.i = load ptr, ptr %this.addr.i, align 8, !dbg !48
4771
ret void
4872
}
4973

0 commit comments

Comments
 (0)