• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -deadargelim -S < %s | FileCheck %s
2;test.c
3;int s;
4;
5;void f2(int k) __attribute__((noinline)) {
6; s++;
7; k = s;
8;}
9;
10;void f() __attribute__((noinline)) {
11; f2(4);
12;}
13;
14;int main()
15;{
16; f();
17; return 0;
18;}
19
20target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
21
22@s = common dso_local local_unnamed_addr global i32 0, align 4, !dbg !0
23
24; Function Attrs: noinline nounwind uwtable
25define dso_local void @f2(i32 %k) local_unnamed_addr !dbg !11 {
26entry:
27; CHECK: call void @llvm.dbg.value(metadata i32 undef, metadata !15, metadata !DIExpression()), !dbg !16
28  call void @llvm.dbg.value(metadata i32 %k, metadata !15, metadata !DIExpression()), !dbg !16
29  %0 = load i32, i32* @s, align 4, !dbg !17
30  %inc = add nsw i32 %0, 1, !dbg !17
31  store i32 %inc, i32* @s, align 4, !dbg !17
32  call void @llvm.dbg.value(metadata i32* @s, metadata !15, metadata !DIExpression(DW_OP_deref)), !dbg !16
33  ret void, !dbg !18
34}
35
36; Function Attrs: noinline nounwind uwtable
37define dso_local void @f() local_unnamed_addr !dbg !19 {
38entry:
39; CHECK: tail call void @f2(i32 undef), !dbg !22
40  tail call void @f2(i32 4), !dbg !22
41  ret void, !dbg !23
42}
43
44; Function Attrs: nounwind uwtable
45define dso_local i32 @main() local_unnamed_addr !dbg !24 {
46entry:
47  tail call void @f(), !dbg !27
48  ret i32 0, !dbg !28
49}
50
51; Function Attrs: nounwind readnone speculatable
52declare void @llvm.dbg.value(metadata, metadata, metadata)
53
54!llvm.dbg.cu = !{!2}
55!llvm.module.flags = !{!7, !8, !9}
56!llvm.ident = !{!10}
57
58!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
59!1 = distinct !DIGlobalVariable(name: "s", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
60!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 8.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
61!3 = !DIFile(filename: "test.c", directory: "/dir")
62!4 = !{}
63!5 = !{!0}
64!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
65!7 = !{i32 2, !"Dwarf Version", i32 4}
66!8 = !{i32 2, !"Debug Info Version", i32 3}
67!9 = !{i32 1, !"wchar_size", i32 4}
68!10 = !{!"clang version 7.0.0"}
69!11 = distinct !DISubprogram(name: "f2", scope: !3, file: !3, line: 3, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !14)
70!12 = !DISubroutineType(types: !13)
71!13 = !{null, !6}
72!14 = !{!15}
73!15 = !DILocalVariable(name: "k", arg: 1, scope: !11, file: !3, line: 3, type: !6)
74!16 = !DILocation(line: 3, column: 13, scope: !11)
75!17 = !DILocation(line: 4, column: 3, scope: !11)
76!18 = !DILocation(line: 6, column: 1, scope: !11)
77!19 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 8, type: !20, isLocal: false, isDefinition: true, scopeLine: 8, isOptimized: true, unit: !2, retainedNodes: !4)
78!20 = !DISubroutineType(types: !21)
79!21 = !{null}
80!22 = !DILocation(line: 9, column: 2, scope: !19)
81!23 = !DILocation(line: 10, column: 1, scope: !19)
82!24 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 12, type: !25, isLocal: false, isDefinition: true, scopeLine: 12, isOptimized: true, unit: !2, retainedNodes: !4)
83!25 = !DISubroutineType(types: !26)
84!26 = !{!6}
85!27 = !DILocation(line: 13, column: 2, scope: !24)
86!28 = !DILocation(line: 14, column: 2, scope: !24)
87