xref: /llvm-project/llvm/test/DebugInfo/X86/bbjoin.ll (revision 5a288fa32e0c91b211e39f3e370255916902f898)
1; RUN: llc -mtriple=x86_64-apple-macosx10.9.0 %s -stop-after=livedebugvars \
2; RUN:   -o - | FileCheck %s
3; Generated from:
4; void g(int *);
5; int f() {
6;   int x = 23;
7;   g(&x);
8;   if (x == 42)
9;     ++x;
10;   return x; // check that x is not a constant here.
11; }
12; CHECK: ![[X:.*]] = !DILocalVariable(name: "x",
13; CHECK: bb.0.entry:
14; CHECK:   DBG_VALUE 23, $noreg, ![[X]],
15; CHECK:   DBG_VALUE $rsp, $noreg, ![[X]], !DIExpression(DW_OP_plus_uconst, 4, DW_OP_deref),
16; CHECK: bb.1.if.then:
17; CHECK:   DBG_VALUE 43, $noreg, ![[X]],
18; CHECK: bb.2.if.end:
19; CHECK-NOT:  DBG_VALUE 23, $noreg, ![[X]],
20; CHECK:   RET64 $eax
21
22target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
23target triple = "x86_64-apple-macosx10.11.0"
24
25; Function Attrs: nounwind ssp uwtable
26define i32 @f() #0 !dbg !4 {
27entry:
28  %x = alloca i32, align 4
29  call void @llvm.lifetime.start(i64 4, ptr %x) #4, !dbg !14
30  tail call void @llvm.dbg.value(metadata i32 23, metadata !9, metadata !15), !dbg !16
31  store i32 23, ptr %x, align 4, !dbg !16, !tbaa !17
32  tail call void @llvm.dbg.value(metadata ptr %x, metadata !9, metadata !DIExpression(DW_OP_deref)), !dbg !16
33  call void @g(ptr nonnull %x) #4, !dbg !21
34  call void @llvm.dbg.value(metadata ptr %x, metadata !9, metadata !DIExpression(DW_OP_deref)), !dbg !16
35  %0 = load i32, ptr %x, align 4, !dbg !22, !tbaa !17
36  %cmp = icmp eq i32 %0, 42, !dbg !24
37  br i1 %cmp, label %if.then, label %if.end, !dbg !25
38
39if.then:                                          ; preds = %entry
40  call void @llvm.dbg.value(metadata i32 43, metadata !9, metadata !15), !dbg !16
41  store i32 43, ptr %x, align 4, !dbg !26, !tbaa !17
42  br label %if.end, !dbg !26
43
44if.end:                                           ; preds = %if.then, %entry
45  %1 = phi i32 [ 43, %if.then ], [ %0, %entry ], !dbg !27
46  call void @llvm.dbg.value(metadata ptr %x, metadata !9, metadata !DIExpression(DW_OP_deref)), !dbg !16
47  call void @llvm.lifetime.end(i64 4, ptr %x) #4, !dbg !28
48  ret i32 %1, !dbg !29
49}
50
51; Function Attrs: argmemonly nounwind
52declare void @llvm.lifetime.start(i64, ptr nocapture) #1
53
54declare void @g(ptr) #4
55
56; Function Attrs: argmemonly nounwind
57declare void @llvm.lifetime.end(i64, ptr nocapture) #1
58
59; Function Attrs: nounwind readnone
60declare void @llvm.dbg.value(metadata, metadata, metadata) #3
61
62attributes #0 = { nounwind ssp uwtable }
63attributes #1 = { argmemonly nounwind }
64attributes #3 = { nounwind readnone }
65attributes #4 = { nounwind }
66
67!llvm.dbg.cu = !{!0}
68!llvm.module.flags = !{!10, !11, !12}
69!llvm.ident = !{!13}
70
71!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 255890) (llvm/trunk 255919)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
72!1 = !DIFile(filename: "constant.c", directory: "")
73!2 = !{}
74!4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: true, unit: !0, retainedNodes: !8)
75!5 = !DISubroutineType(types: !6)
76!6 = !{!7}
77!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
78!8 = !{!9}
79!9 = !DILocalVariable(name: "x", scope: !4, file: !1, line: 3, type: !7)
80!10 = !{i32 2, !"Dwarf Version", i32 2}
81!11 = !{i32 2, !"Debug Info Version", i32 3}
82!12 = !{i32 1, !"PIC Level", i32 2}
83!13 = !{!"clang version 3.8.0 (trunk 255890) (llvm/trunk 255919)"}
84!14 = !DILocation(line: 3, column: 3, scope: !4)
85!15 = !DIExpression()
86!16 = !DILocation(line: 3, column: 7, scope: !4)
87!17 = !{!18, !18, i64 0}
88!18 = !{!"int", !19, i64 0}
89!19 = !{!"omnipotent char", !20, i64 0}
90!20 = !{!"Simple C/C++ TBAA"}
91!21 = !DILocation(line: 4, column: 3, scope: !4)
92!22 = !DILocation(line: 5, column: 7, scope: !23)
93!23 = distinct !DILexicalBlock(scope: !4, file: !1, line: 5, column: 7)
94!24 = !DILocation(line: 5, column: 9, scope: !23)
95!25 = !DILocation(line: 5, column: 7, scope: !4)
96!26 = !DILocation(line: 6, column: 5, scope: !23)
97!27 = !DILocation(line: 7, column: 10, scope: !4)
98!28 = !DILocation(line: 8, column: 1, scope: !4)
99!29 = !DILocation(line: 7, column: 3, scope: !4)
100