OSDN Git Service

[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
[android-x86/external-llvm.git] / test / DebugInfo / X86 / inlined-indirect-value.ll
1 ; RUN: llc -filetype=asm -asm-verbose=0 < %s | FileCheck %s
2
3 ; "1" from line 09 in the snippet below shouldn't be marked with location of "1"
4 ; from line 04.  Instead it will have location inside main() (real location is
5 ; just erased, so it won't be perfectly accurate).
6
7 ; options: -g -O3
8 ; 01 volatile int x;
9 ; 02 int y;
10 ; 03 static __attribute__((always_inline)) int f1() {
11 ; 04     if (x * 3 < 14) return 1;
12 ; 05     return 2;
13 ; 06 }
14 ; 07 int main() {
15 ; 08     x = f1();
16 ; 09     x = x ? 1 : 2;
17 ; 10 }
18
19 source_filename = "test/DebugInfo/X86/inlined-indirect-value.ll"
20 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
21 target triple = "x86_64-unknown-linux-gnu"
22
23 @x = common global i32 0, align 4, !dbg !0
24 @y = common global i32 0, align 4, !dbg !6
25
26 define i32 @main() !dbg !12 {
27 ; CHECK: .loc 1 {{[89]}}
28 ; CHECK-NOT: .loc
29 ; CHECK: movl $1
30
31 entry:
32   %0 = load volatile i32, i32* @x, align 4, !dbg !15, !tbaa !19
33   %mul.i = mul nsw i32 %0, 3, !dbg !23
34   %cmp.i = icmp slt i32 %mul.i, 14, !dbg !24
35   %..i = select i1 %cmp.i, i32 1, i32 2, !dbg !25
36   store volatile i32 %..i, i32* @x, align 4, !dbg !27, !tbaa !19
37   %1 = load volatile i32, i32* @x, align 4, !dbg !28, !tbaa !19
38   %tobool = icmp ne i32 %1, 0, !dbg !28
39   br i1 %tobool, label %select.end, label %select.mid
40
41 select.mid:                                       ; preds = %entry
42   br label %select.end
43
44 select.end:                                       ; preds = %select.mid, %entry
45   %cond = phi i32 [ 1, %entry ], [ 2, %select.mid ]
46   store volatile i32 %cond, i32* @x, align 4, !dbg !29, !tbaa !19
47   ret i32 0, !dbg !30
48 }
49
50 !llvm.dbg.cu = !{!2}
51 !llvm.module.flags = !{!10, !11}
52
53 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
54 !1 = !DIGlobalVariable(name: "x", scope: !2, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true)
55 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4, globals: !5, imports: !4)
56 !3 = !DIFile(filename: "inline-break.c", directory: "/build/dir")
57 !4 = !{}
58 !5 = !{!0, !6}
59 !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
60 !7 = !DIGlobalVariable(name: "y", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: true)
61 !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
62 !9 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !8)
63 !10 = !{i32 2, !"Dwarf Version", i32 4}
64 !11 = !{i32 2, !"Debug Info Version", i32 3}
65 !12 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 7, type: !13, isLocal: false, isDefinition: true, scopeLine: 7, isOptimized: true, unit: !2, retainedNodes: !4)
66 !13 = !DISubroutineType(types: !14)
67 !14 = !{!8}
68 !15 = !DILocation(line: 4, column: 9, scope: !16, inlinedAt: !18)
69 !16 = distinct !DILexicalBlock(scope: !17, file: !3, line: 4, column: 9)
70 !17 = distinct !DISubprogram(name: "f1", scope: !3, file: !3, line: 3, type: !13, isLocal: true, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !2, retainedNodes: !4)
71 !18 = distinct !DILocation(line: 8, column: 9, scope: !12)
72 !19 = !{!20, !20, i64 0}
73 !20 = !{!"int", !21, i64 0}
74 !21 = !{!"omnipotent char", !22, i64 0}
75 !22 = !{!"Simple C/C++ TBAA"}
76 !23 = !DILocation(line: 4, column: 11, scope: !16, inlinedAt: !18)
77 !24 = !DILocation(line: 4, column: 15, scope: !16, inlinedAt: !18)
78 !25 = !DILocation(line: 4, column: 21, scope: !26, inlinedAt: !18)
79 !26 = !DILexicalBlockFile(scope: !16, file: !3, discriminator: 1)
80 !27 = !DILocation(line: 8, column: 7, scope: !12)
81 !28 = !DILocation(line: 9, column: 9, scope: !12)
82 !29 = !DILocation(line: 9, column: 7, scope: !12)
83 !30 = !DILocation(line: 10, column: 1, scope: !12)
84