• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -O1 -o - %s | FileCheck %s
2
3; Check that dbg.value(undef) calls are not simply discarded.
4
5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6target triple = "x86_64-unknown-linux-gnu"
7
8define void @foo() !dbg !7 {
9entry:
10  call void @llvm.dbg.value(metadata i32 42, metadata !11, metadata !DIExpression()), !dbg !13
11  call void (...) @bar(), !dbg !14
12  call void @llvm.dbg.value(metadata i32 undef, metadata !11, metadata !DIExpression()), !dbg !13
13  call void (...) @bar(), !dbg !15
14  ret void, !dbg !16
15}
16
17declare void @bar(...)
18
19; Function Attrs: nounwind readnone speculatable
20declare void @llvm.dbg.value(metadata, metadata, metadata) #0
21
22attributes #0 = { nounwind readnone speculatable }
23
24!llvm.dbg.cu = !{!0}
25!llvm.module.flags = !{!3, !4, !5}
26!llvm.ident = !{!6}
27
28!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 7.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
29!1 = !DIFile(filename: "test.c", directory: "/tmp")
30!2 = !{}
31!3 = !{i32 2, !"Dwarf Version", i32 4}
32!4 = !{i32 2, !"Debug Info Version", i32 3}
33!5 = !{i32 1, !"wchar_size", i32 4}
34!6 = !{!"clang version 7.0.0"}
35!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, retainedNodes: !10)
36!8 = !DISubroutineType(types: !9)
37!9 = !{null}
38!10 = !{!11}
39!11 = !DILocalVariable(name: "x", scope: !7, file: !1, line: 4, type: !12)
40!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
41!13 = !DILocation(line: 4, column: 7, scope: !7)
42!14 = !DILocation(line: 5, column: 3, scope: !7)
43!15 = !DILocation(line: 7, column: 3, scope: !7)
44!16 = !DILocation(line: 8, column: 1, scope: !7)
45
46; Original C program:
47;  void bar();
48;
49;  void foo() {
50;    int x = 42;
51;    bar();
52;    x = 23;
53;    bar();
54;  }
55;
56; Then the dbg.value for the x = 23 setting has been replaced with dbg.value(undef)
57; in this ll file to provoke the wanted behavior in LiveDebugVariables.
58
59; Variable 'x' should thus be updated two times, first to 42 and then to undef.
60
61; CHECK-LABEL: foo:
62; CHECK:               #DEBUG_VALUE: foo:x <- 42
63; CHECK:               callq   bar
64; CHECK:               #DEBUG_VALUE: foo:x <- undef
65; CHECK:               callq   bar
66